summaryrefslogtreecommitdiffstats
path: root/libavcodec/subviewerdec.c
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2014-09-20 22:17:29 +0200
committerClément Bœsch <u@pkh.me>2014-09-21 18:41:45 +0200
commit947a5111dd58fc97127abf84235c7c26b88734fc (patch)
tree6972254402c022ea68a0dec035db2f08636c7ac9 /libavcodec/subviewerdec.c
parent592716227c5f8d662b1ef8fb4f5f4a22cfa751c7 (diff)
downloadffmpeg-streaming-947a5111dd58fc97127abf84235c7c26b88734fc.zip
ffmpeg-streaming-947a5111dd58fc97127abf84235c7c26b88734fc.tar.gz
avcodec/subviewerdec: add some memory checks
Diffstat (limited to 'libavcodec/subviewerdec.c')
-rw-r--r--libavcodec/subviewerdec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/subviewerdec.c b/libavcodec/subviewerdec.c
index 63be418..b41f7a9 100644
--- a/libavcodec/subviewerdec.c
+++ b/libavcodec/subviewerdec.c
@@ -51,6 +51,7 @@ static int subviewer_decode_frame(AVCodecContext *avctx,
void *data, int *got_sub_ptr, AVPacket *avpkt)
{
char c;
+ int ret = 0;
AVSubtitle *sub = data;
const char *ptr = avpkt->data;
AVBPrint buf;
@@ -67,9 +68,11 @@ static int subviewer_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 && !subviewer_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