Message ID | 20210916223558.1226-1-michael@niedermayer.cc |
---|---|
State | Accepted |
Commit | 83b2e4c8f15a00f037040131e26e20de83f0d842 |
Headers | show |
Series | [FFmpeg-devel,1/2] avformat/mpegts: use actually read packet size in mpegts_resync special case | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
andriy/make_ppc | success | Make finished |
andriy/make_fate_ppc | success | Make fate finished |
On Fri, 17 Sep 2021, Michael Niedermayer wrote: > Fixes: infinite loop > Fixes: 37986/clusterfuzz-testcase-minimized-ffmpeg_dem_MPEGTSRAW_fuzzer-5292311517462528 - LGTM, thanks. Marton > > 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 | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c > index fe89d4fb9f3..bd13118f7f7 100644 > --- a/libavformat/mpegts.c > +++ b/libavformat/mpegts.c > @@ -2865,8 +2865,8 @@ static int mpegts_resync(AVFormatContext *s, int seekback, const uint8_t *curren > int64_t back = FFMIN(seekback, pos); > > //Special case for files like 01c56b0dc1.ts > - if (current_packet[0] == 0x80 && current_packet[12] == 0x47) { > - avio_seek(pb, 12 - back, SEEK_CUR); > + if (current_packet[0] == 0x80 && current_packet[12] == 0x47 && pos >= TS_PACKET_SIZE) { > + avio_seek(pb, 12 - TS_PACKET_SIZE, SEEK_CUR); > return 0; > } > > -- > 2.17.1 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". >
On Sat, Sep 18, 2021 at 09:10:40PM +0200, Marton Balint wrote: > > > On Fri, 17 Sep 2021, Michael Niedermayer wrote: > > > Fixes: infinite loop > > Fixes: 37986/clusterfuzz-testcase-minimized-ffmpeg_dem_MPEGTSRAW_fuzzer-5292311517462528 - > > LGTM, thanks. will apply thx [...]
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index fe89d4fb9f3..bd13118f7f7 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -2865,8 +2865,8 @@ static int mpegts_resync(AVFormatContext *s, int seekback, const uint8_t *curren int64_t back = FFMIN(seekback, pos); //Special case for files like 01c56b0dc1.ts - if (current_packet[0] == 0x80 && current_packet[12] == 0x47) { - avio_seek(pb, 12 - back, SEEK_CUR); + if (current_packet[0] == 0x80 && current_packet[12] == 0x47 && pos >= TS_PACKET_SIZE) { + avio_seek(pb, 12 - TS_PACKET_SIZE, SEEK_CUR); return 0; }
Fixes: infinite loop Fixes: 37986/clusterfuzz-testcase-minimized-ffmpeg_dem_MPEGTSRAW_fuzzer-5292311517462528 - 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)