Commit 43fe5031 authored by Michael Niedermayer's avatar Michael Niedermayer

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/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 19c41969)
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 45eef1be
...@@ -1892,6 +1892,9 @@ static int parse_packet_header(WMAVoiceContext *s) ...@@ -1892,6 +1892,9 @@ static int parse_packet_header(WMAVoiceContext *s)
skip_bits(gb, 4); // packet sequence number skip_bits(gb, 4); // packet sequence number
s->has_residual_lsps = get_bits1(gb); s->has_residual_lsps = get_bits1(gb);
do { do {
if (get_bits_left(gb) < 6 + s->spillover_bitsize)
return AVERROR_INVALIDDATA;
res = get_bits(gb, 6); // number of superframes per packet res = get_bits(gb, 6); // number of superframes per packet
// (minus first one if there is spillover) // (minus first one if there is spillover)
if (get_bits_left(gb) < 6 * (res == 0x3F) + s->spillover_bitsize) if (get_bits_left(gb) < 6 * (res == 0x3F) + s->spillover_bitsize)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment