1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/srtdec: add some memory checks

This commit is contained in:
Clément Bœsch 2014-09-20 22:14:11 +02:00
parent 6a65da3a18
commit 592716227c

View File

@ -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;