diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-11-15 14:52:21 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-11-26 15:12:27 +0100 |
commit | b0a5794e30d6ce8ec2217c64368f373863e17dcb (patch) | |
tree | c854a8740347ef057c52126d1b437599afb4dda4 | |
parent | 63504a2d44e51999e3ce11a4b172a1b3965a2996 (diff) | |
download | ffmpeg-b0a5794e30d6ce8ec2217c64368f373863e17dcb.tar.gz |
avcodec/movtextdec: Fix tsmb_size check==0 check
Fixes: 173/fuzz-3-ffmpeg_SUBTITLE_AV_CODEC_ID_MOV_TEXT_fuzzer
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit a609905723c01e356d35146425c3d45c090aae7b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/movtextdec.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c index a2b50b018f..127ac6bd9d 100644 --- a/libavcodec/movtextdec.c +++ b/libavcodec/movtextdec.c @@ -476,10 +476,6 @@ static int mov_text_decode_frame(AVCodecContext *avctx, tsmb_type = AV_RB32(tsmb); tsmb += 4; - if (tsmb_size == 0) { - return AVERROR_INVALIDDATA; - } - if (tsmb_size == 1) { if (m->tracksize + 16 > avpkt->size) break; @@ -490,6 +486,10 @@ static int mov_text_decode_frame(AVCodecContext *avctx, m->size_var = 8; //size_var is equal to 8 or 16 depending on the size of box + if (tsmb_size == 0) { + return AVERROR_INVALIDDATA; + } + if (tsmb_size > avpkt->size - m->tracksize) break; |