summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Kolesa <daniel@octaforge.org>2022-12-23 02:32:12 +0100
committerTimo Teräs <timo.teras@iki.fi>2022-12-23 09:12:54 +0200
commita7f5996e2fc2b4ec00d40f3ae53a56cb6d8dbca0 (patch)
tree5307ee61868ea19bba9e27e7eb9f1018f0ecc505 /src
parentb75ffff1551cf100e879e5aca3404b947a540581 (diff)
downloadapk-tools-a7f5996e2fc2b4ec00d40f3ae53a56cb6d8dbca0.tar.gz
apk-tools-a7f5996e2fc2b4ec00d40f3ae53a56cb6d8dbca0.tar.bz2
apk-tools-a7f5996e2fc2b4ec00d40f3ae53a56cb6d8dbca0.tar.xz
apk-tools-a7f5996e2fc2b4ec00d40f3ae53a56cb6d8dbca0.zip
defines: fix UB in get_unaligned32
Diffstat (limited to 'src')
-rw-r--r--src/apk_defines.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/apk_defines.h b/src/apk_defines.h
index dbb21bf..086dc96 100644
--- a/src/apk_defines.h
+++ b/src/apk_defines.h
@@ -162,7 +162,7 @@ static inline uint32_t get_unaligned32(const void *ptr)
return *(const uint32_t *)ptr;
#else
const uint8_t *p = ptr;
- return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;
+ return p[0] | (uint32_t)p[1] << 8 | (uint32_t)p[2] << 16 | (uint32_t)p[3] << 24;
#endif
}