[FFmpeg-cvslog] avformat/mpegts: use actually read packet size in mpegts_resync special case
Michael Niedermayer
git at videolan.org
Thu Oct 21 00:41:10 EEST 2021
ffmpeg | branch: release/4.3 | Michael Niedermayer <michael at niedermayer.cc> | Thu Sep 16 23:12:42 2021 +0200| [bfc04caa2fe66a4dab2a02ac96fa487fd825f8b6] | committer: Michael Niedermayer
avformat/mpegts: use actually read packet size in mpegts_resync special case
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
Reviewed-by: Marton Balint <cus at passwd.hu>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 83b2e4c8f15a00f037040131e26e20de83f0d842)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bfc04caa2fe66a4dab2a02ac96fa487fd825f8b6
---
libavformat/mpegts.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index b0137ceb7a..7b1be3b5e2 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2847,8 +2847,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;
}
More information about the ffmpeg-cvslog
mailing list