summaryrefslogtreecommitdiffstats
path: root/libavcodec/realtextdec.c
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2014-09-20 22:11:45 +0200
committerClément Bœsch <u@pkh.me>2014-09-21 18:41:45 +0200
commit8e7808b524d1e2a0063b1a0476a1fee2ac5742b5 (patch)
treefba0fcffc7f1fa4e526669ae3d8ff7a929b3462c /libavcodec/realtextdec.c
parent27a9bee243c7990ad0c6f9d6bd9ae34d2000f1dd (diff)
downloadffmpeg-streaming-8e7808b524d1e2a0063b1a0476a1fee2ac5742b5.zip
ffmpeg-streaming-8e7808b524d1e2a0063b1a0476a1fee2ac5742b5.tar.gz
avcodec/realtextdec: add some memory checks
Diffstat (limited to 'libavcodec/realtextdec.c')
-rw-r--r--libavcodec/realtextdec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/realtextdec.c b/libavcodec/realtextdec.c
index 4578897..602df4c 100644
--- a/libavcodec/realtextdec.c
+++ b/libavcodec/realtextdec.c
@@ -59,6 +59,7 @@ static int rt_event_to_ass(AVBPrint *buf, const char *p)
static int realtext_decode_frame(AVCodecContext *avctx,
void *data, int *got_sub_ptr, AVPacket *avpkt)
{
+ int ret = 0;
AVSubtitle *sub = data;
const char *ptr = avpkt->data;
AVBPrint buf;
@@ -67,9 +68,11 @@ static int realtext_decode_frame(AVCodecContext *avctx,
// note: no need to rescale pts & duration since they are in the same
// timebase as ASS (1/100)
if (ptr && avpkt->size > 0 && !rt_event_to_ass(&buf, ptr))
- ff_ass_add_rect(sub, buf.str, avpkt->pts, avpkt->duration, 0);
- *got_sub_ptr = sub->num_rects > 0;
+ ret = ff_ass_add_rect_bprint(sub, &buf, avpkt->pts, avpkt->duration, 0);
av_bprint_finalize(&buf, NULL);
+ if (ret < 0)
+ return ret;
+ *got_sub_ptr = sub->num_rects > 0;
return avpkt->size;
}
OpenPOWER on IntegriCloud