aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-12-04 00:52:47 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-17 21:34:53 +0200
commit93cdec591b98fa39ce7e056f5c868a676e6f7c17 (patch)
treec23d35a21fb85110ec3e7f37e84f78d826965342
parent9dc6c0d8d0265844536aa2674af021be26531e34 (diff)
downloadffmpeg-93cdec591b98fa39ce7e056f5c868a676e6f7c17.tar.gz
avcodec/wmaprodec: Check packet size
Fixes: left shift of negative value -25824 Fixes: 27754/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA2_fuzzer-5760255962906624 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 69aeba8a19ac2fa6e1c9bdfb19229b513f314bb1) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/wmaprodec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index b3f4c8f59a..9f74914b26 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -1607,6 +1607,12 @@ static int decode_packet(AVCodecContext *avctx, void *data,
} else {
int frame_size;
+
+ if (avpkt->size < s->next_packet_start) {
+ s->packet_loss = 1;
+ return AVERROR_INVALIDDATA;
+ }
+
s->buf_bit_size = (avpkt->size - s->next_packet_start) << 3;
init_get_bits(gb, avpkt->data, s->buf_bit_size);
skip_bits(gb, s->packet_offset);