avcodec/adxenc: Avoid undefined left shift of negative numbers
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 20 Jan 2020 19:20:42 +0000 (20:20 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 21 Jan 2020 09:01:46 +0000 (10:01 +0100)
commit59a9d65e0d790821f88527a82569f56eb2f8a9be
treedfebdd362acebc6ee3b6d8294557e23e4f7ac4b1
parent3ad8af51b7c0a968ac3fd62964780d4ff9136c5a
avcodec/adxenc: Avoid undefined left shift of negative numbers

Replace "((a << shift) + b) >> shift" by "a + (b >> shift)". This avoids
a left shift which also happens to trigger undefined behaviour in case "a"
is negative. This affected the FATE-tests acodec-adpcm-adx and
acodec-adpcm-adx-trellis; it also fixes ticket #8008.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/adxenc.c