aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2014-09-20 22:14:11 +0200
committerClément Bœsch <u@pkh.me>2014-09-21 18:41:45 +0200
commit592716227c5f8d662b1ef8fb4f5f4a22cfa751c7 (patch)
treebcc7ce206e5cf74c4e6e8f098fb549ea1ae297d6
parent6a65da3a182cd237ba7251de89aaa5168e266497 (diff)
downloadffmpeg-592716227c5f8d662b1ef8fb4f5f4a22cfa751c7.tar.gz
avcodec/srtdec: add some memory checks
-rw-r--r--libavcodec/srtdec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/srtdec.c b/libavcodec/srtdec.c
index b16645a01e..794a25a547 100644
--- a/libavcodec/srtdec.c
+++ b/libavcodec/srtdec.c
@@ -223,7 +223,7 @@ static int srt_decode_frame(AVCodecContext *avctx,
char buffer[2048];
const char *ptr = avpkt->data;
const char *end = avpkt->data + avpkt->size;
- int size;
+ int size, ret;
const uint8_t *p = av_packet_get_side_data(avpkt, AV_PKT_DATA_SUBTITLE_POSITION, &size);
if (p && size == 16) {
@@ -252,7 +252,9 @@ static int srt_decode_frame(AVCodecContext *avctx,
}
ptr = srt_to_ass(avctx, buffer, buffer+sizeof(buffer), ptr,
x1, y1, x2, y2);
- ff_ass_add_rect(sub, buffer, ts_start, ts_end-ts_start, 0);
+ ret = ff_ass_add_rect(sub, buffer, ts_start, ts_end-ts_start, 0);
+ if (ret < 0)
+ return ret;
}
*got_sub_ptr = sub->num_rects > 0;