Message ID | 20201022224112.9071-1-michael@niedermayer.cc |
---|---|
State | Accepted |
Commit | 4bdb7966fac87fdbf76f4828a3fbe14fd874679c |
Headers | show |
Series | [FFmpeg-devel,1/5] avformat/mpegts: Limit iterations of get_packet_size() | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
On Fri, Oct 23, 2020 at 12:41:08AM +0200, Michael Niedermayer wrote: > This is a pathological case where the fuzzer provides only 2 bytes per iteration. > > Fixes: Timeout (>30 -> 0.9sec) > Fixes: 26488/clusterfuzz-testcase-minimized-ffmpeg_dem_MPEGTS_fuzzer-5911031077142528 > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > libavformat/mpegts.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) will apply patchset [...]
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 3085371c58..4e5f556d94 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -609,8 +609,9 @@ static int get_packet_size(AVFormatContext* s) /*init buffer to store stream for probing */ uint8_t buf[PROBE_PACKET_MAX_BUF] = {0}; int buf_size = 0; + int max_iterations = 16; - while (buf_size < PROBE_PACKET_MAX_BUF) { + while (buf_size < PROBE_PACKET_MAX_BUF && max_iterations--) { ret = avio_read_partial(s->pb, buf + buf_size, PROBE_PACKET_MAX_BUF - buf_size); if (ret < 0) return AVERROR_INVALIDDATA;
This is a pathological case where the fuzzer provides only 2 bytes per iteration. Fixes: Timeout (>30 -> 0.9sec) Fixes: 26488/clusterfuzz-testcase-minimized-ffmpeg_dem_MPEGTS_fuzzer-5911031077142528 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavformat/mpegts.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)