If indic_bit == 0, the shift amount of 32 - indic_bit == 32 will equal
the width of a 32-bit integer type, and these shifts will invoke
undefined behaviour, which is likely to cause incorrect output. Fix this
by not shifting a 32-bit integer type by 32 bits or more.
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
}
}
- indic <<= 32 - indic_bit;
- indic |= (1 << (32 - indic_bit)) - 1;
+ if (indic_bit != 0) {
+ indic <<= 32 - indic_bit;
+ }
+ indic |= UINT32_MAX >> indic_bit;
PUSH_LE_U32(compressed, indic_pos, indic);
return compressed_pos;
+++ /dev/null
-samba4.local.compression.lzxpress6