[FFmpeg-cvslog] avcodec/wmv2dec: Skip I frame if its smaller than 1/8 of the minimal size
Michael Niedermayer
git at videolan.org
Tue Jan 15 02:18:25 EET 2019
ffmpeg | branch: release/3.2 | Michael Niedermayer <michael at niedermayer.cc> | Tue Nov 27 23:37:03 2018 +0100| [4ff4fd41791c4cb22dd87cb115bd6f7980f4a73a] | committer: Michael Niedermayer
avcodec/wmv2dec: Skip I frame if its smaller than 1/8 of the minimal size
Frames that small are not valid and of limited use for error concealment, while
being very computationally intensive to process.
Fixes: Timeout
Fixes: 11168/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV2_fuzzer-5733782032744448
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit d6f4341522c3eafb046c47b115d79ce684a899fc)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4ff4fd41791c4cb22dd87cb115bd6f7980f4a73a
---
libavcodec/wmv2dec.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index 225e30ab5a..1aa0da0271 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -166,6 +166,14 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
}
s->dc_table_index = get_bits1(&s->gb);
+
+ // at minimum one bit per macroblock is required at least in a valid frame,
+ // we discard frames much smaller than this. Frames smaller than 1/8 of the
+ // smallest "black/skip" frame generally contain not much recoverable content
+ // while at the same time they have the highest computational requirements
+ // per byte
+ if (get_bits_left(&s->gb) * 8LL < (s->width+15)/16 * ((s->height+15)/16))
+ return AVERROR_INVALIDDATA;
}
s->inter_intra_pred = 0;
s->no_rounding = 1;
More information about the ffmpeg-cvslog
mailing list