Skip to content

Commit aca6801

Browse files
Dutchman101tmatth
authored andcommitted
Fix issue #25 (Undefined behavior / Arithmetic overflow in bits.c)
Signed-off-by: Tristan Matthews <[email protected]>
1 parent 1de1260 commit aca6801

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libspeex/bits.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ EXPORT int speex_bits_unpack_signed(SpeexBits *bits, int nbBits)
275275
/* If number is negative */
276276
if (d>>(nbBits-1))
277277
{
278-
d |= (-1)<<nbBits;
278+
d |= (~0u)<<nbBits;
279279
}
280280
return d;
281281
}

0 commit comments

Comments
 (0)