aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer2019-11-23 09:18:12 +0100
committerMichael Niedermayer2019-12-31 19:51:57 +0100
commitddb35d510eac5c4574b3fe227ab39bc3cf71d459 (patch)
treecc1086b011d44244db31ee0ba7300d5fa190460c
parent846c61789c81c8118a30e6bd3524e2961c868086 (diff)
avcodec/wmavoice: Check remaining input in parse_packet_header()
Fixes: Infinite loop Fixes: 18914/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAVOICE_fuzzer-5731902946541568 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 19c41969b26d07519fff8182a0d3266cdb712078) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/wmavoice.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index 5dd9b3dbb7..5f8987ac38 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -1843,6 +1843,9 @@ static int parse_packet_header(WMAVoiceContext *s)
skip_bits(gb, 4); // packet sequence number
s->has_residual_lsps = get_bits1(gb);
do {
+ if (get_bits_left(gb) < 6 + s->spillover_bitsize)
+ return AVERROR_INVALIDDATA;
+
res = get_bits(gb, 6); // number of superframes per packet
// (minus first one if there is spillover)
n_superframes += res;