summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;