From: Andreas Schneider Date: Thu, 22 Nov 2018 14:11:09 +0000 (+0100) Subject: lib:compression: Fix undefined behavior in lzxpress X-Git-Tag: tdb-1.3.17~664 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aab5034a9ddc57ee9ce14ce584e53bd9b96b7a58;p=thirdparty%2Fsamba.git lib:compression: Fix undefined behavior in lzxpress lib/compression/lzxpress.c:228 runtime error: store to misaligned address 0x5631d53ca9fe for type 'uint32_t', which requires 4 byte alignment Signed-off-by: Andreas Schneider Reviewed-by: Gary Lockyer --- diff --git a/lib/compression/lzxpress.c b/lib/compression/lzxpress.c index a4ded7e4555..024aba4c2ce 100644 --- a/lib/compression/lzxpress.c +++ b/lib/compression/lzxpress.c @@ -225,7 +225,7 @@ ssize_t lzxpress_compress(const uint8_t *uncompressed, for (; (indic_bit % 32) != 0; indic_bit++) indic |= 0 << (32 - ((indic_bit % 32) + 1)); - *(uint32_t *)&compressed[compressed_pos] = 0; + SIVAL(compressed, compressed_pos, 0); SIVAL(indic_pos, 0, indic); compressed_pos += sizeof(uint32_t); }