summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2023-06-20 00:13:43 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2023-09-14 22:00:17 +0200
commit90647a9249aee8c0ef6c0bced3558ada9643f5b6 (patch)
treef94ddc67883e8064779d612db5e24a98a08ad545
parentca09d8a0dcd82e3128e62463231296aaf63ae6f7 (diff)
avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure
Fixes: left shift of negative value -1 Fixes: 59889/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HUFFYUV_fuzzer-5472742275940352 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/huffyuvdec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 0b7f91dd0a..ce6d4d4c59 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -757,7 +757,7 @@ static void decode_plane_bitstream(HYuvDecContext *s, int width, int plane)
}
}
if( width&1 && get_bits_left(&s->gb)>0 ) {
- int dst = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)<<2;
+ int dst = (unsigned)get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)<<2;
s->temp16[0][width-1] = dst + get_bits(&s->gb, 2);
}
}