aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2024-01-02 12:29:20 +0100
committerGitHub <noreply@github.com>2024-01-02 12:29:20 +0100
commit3dbd89eee87dd3b730a1fff6015e0f2f70d01fa4 (patch)
treefa3fdfb8101027be8d9ae1d4bbd82c7b882f1152 /src
parent308f71a6e80751eae09f08cdfdc996a77510e5a5 (diff)
sha256: fix undefined-shift error (#2237)
``` third_party/src/ndpi_sha256.c:51:21: runtime error: left shift of 128 by 24 places cannot be represented in type 'int' ``` Found by oss-fuzzer See: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=65305
Diffstat (limited to 'src')
-rw-r--r--src/lib/third_party/src/ndpi_sha256.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/third_party/src/ndpi_sha256.c b/src/lib/third_party/src/ndpi_sha256.c
index a98f46622..18f64bbd7 100644
--- a/src/lib/third_party/src/ndpi_sha256.c
+++ b/src/lib/third_party/src/ndpi_sha256.c
@@ -48,7 +48,7 @@ void sha256_transform(ndpi_SHA256_CTX *ctx, const u_int8_t data[])
u_int32_t a, b, c, d, e, f, g, h, i, j, t1, t2, m[64];
for (i = 0, j = 0; i < 16; ++i, j += 4)
- m[i] = (data[j] << 24) | (data[j + 1] << 16) | (data[j + 2] << 8) | (data[j + 3]);
+ m[i] = ((u_int32_t)data[j] << 24) | ((u_int32_t)data[j + 1] << 16) | ((u_int32_t)data[j + 2] << 8) | (data[j + 3]);
for ( ; i < 64; ++i)
m[i] = SIG1(m[i - 2]) + m[i - 7] + SIG0(m[i - 15]) + m[i - 16];