summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-04-08 03:29:44 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2018-07-08 19:45:46 +0200
commit173fdd9b65a877946b6a8decaaafcd5295c3517b (patch)
treeeeae63aef314559493a1f705d4b9a3cbb98f88d0 /libavcodec
parent626da21af80ca3db94b85bc2bcd1799fff7b5ee5 (diff)
downloadffmpeg-173fdd9b65a877946b6a8decaaafcd5295c3517b.tar.gz
avcodec/movtextdec: Check style_start/end
Limits based on 3GPP TS 26.245 V14.0.0 Fixes: Timeout Fixes: 6377/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOVTEXT_fuzzer-5175929115508736 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Philip Langdale <philipl@overt.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 249aca8f98ff7fb09c12ea68e23c862c62203b95) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/movtextdec.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
index 81fd1d6deb..ad6e921d61 100644
--- a/libavcodec/movtextdec.c
+++ b/libavcodec/movtextdec.c
@@ -299,6 +299,14 @@ static int decode_styl(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt)
m->s_temp->style_start = AV_RB16(tsmb);
tsmb += 2;
m->s_temp->style_end = AV_RB16(tsmb);
+
+ if ( m->s_temp->style_end < m->s_temp->style_start
+ || (m->count_s && m->s_temp->style_start < m->s[m->count_s - 1]->style_end)) {
+ av_freep(&m->s_temp);
+ mov_text_cleanup(m);
+ return AVERROR(ENOMEM);
+ }
+
tsmb += 2;
m->s_temp->style_fontID = AV_RB16(tsmb);
tsmb += 2;