aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2023-04-09 13:18:42 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2023-06-04 20:18:22 +0200
commit8c8821b545a287c7a297d0adc83043708e65f526 (patch)
tree6bbb57e87cc9d9a56c1433c75bab12acc90eb9aa
parentdb29a662954b44b04c2c5e861bd51d20fcc2d8f3 (diff)
downloadffmpeg-8c8821b545a287c7a297d0adc83043708e65f526.tar.gz
avcodec/huffyuvdec: Fix undefined behavior with shift
Fixes: left shift of negative value -1 Fixes: 57554/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFVHUFF_fuzzer-4853603839115264 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 27e7857bd1127974ffe1512293abee83b1035194) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/huffyuvdec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index f6a51c3320..4b8bc5b858 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -691,9 +691,9 @@ static void decode_422_bitstream(HYuvContext *s, int count)
/* TODO instead of restarting the read when the code isn't in the first level
* of the joint table, jump into the 2nd level of the individual table. */
#define READ_2PIX_PLANE16(dst0, dst1, plane){\
- dst0 = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)<<2;\
+ dst0 = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)*4;\
dst0 += get_bits(&s->gb, 2);\
- dst1 = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)<<2;\
+ dst1 = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)*4;\
dst1 += get_bits(&s->gb, 2);\
}
static void decode_plane_bitstream(HYuvContext *s, int width, int plane)