summaryrefslogtreecommitdiff
path: root/libavcodec/movtextdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-11-15 14:52:21 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-11-15 15:08:20 +0100
commita609905723c01e356d35146425c3d45c090aae7b (patch)
tree840c39eb18dd45c616b936cf3d60943ce63ec626 /libavcodec/movtextdec.c
parent6ea27157682200e5f78cadcabdb009eccd9dd9b1 (diff)
downloadffmpeg-a609905723c01e356d35146425c3d45c090aae7b.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>
Diffstat (limited to 'libavcodec/movtextdec.c')
-rw-r--r--libavcodec/movtextdec.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
index 923e58299b..0618f375fc 100644
--- a/libavcodec/movtextdec.c
+++ b/libavcodec/movtextdec.c
@@ -471,10 +471,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;
@@ -485,6 +481,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;