idct8x8: Fix undefined negative shifts
authorKaterina Barone-Adesi <katerinab@gmail.com>
Wed, 2 Mar 2016 23:52:25 +0000 (18:52 -0500)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Sat, 5 Mar 2016 13:26:36 +0000 (08:26 -0500)
commit1389b4c18d1042c196603ba66c25113bcee1738b
treee7a6f5258a868a4e6b854f986773431debe6eb38
parente10b7ef2fe56603fb1baac6b20fd6bd0a3fdd0d0
idct8x8: Fix undefined negative shifts

The original code left-shifts negative values, which is undefined
in the C99 specification (the one used during normal Libav compilation).
This change multiplies by (1 << shift), which is functionally equivalent,
but has defined behavior.

With this change, fate-idct8x8 compiled with --fsanitize=undefined works.

Bug-Id: 686
libavcodec/jfdctint_template.c
libavcodec/jrevdct.c
libavcodec/simple_idct_template.c