aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2014-09-20 21:48:13 +0200
committerClément Bœsch <u@pkh.me>2014-09-21 18:41:45 +0200
commit4c85073044a6cb4c28210ebece9013947ea84a04 (patch)
tree4185d0b219f8fe143c57d8cb835983e889b0a90b
parentd210c0e777c181f3954582703c95e85d885d68c1 (diff)
downloadffmpeg-4c85073044a6cb4c28210ebece9013947ea84a04.tar.gz
avcodec/jacosubdec: add some memory checks
-rw-r--r--libavcodec/jacosubdec.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libavcodec/jacosubdec.c b/libavcodec/jacosubdec.c
index b64fac8a75..bb9d6aaa59 100644
--- a/libavcodec/jacosubdec.c
+++ b/libavcodec/jacosubdec.c
@@ -168,6 +168,7 @@ static void jacosub_to_ass(AVCodecContext *avctx, AVBPrint *dst, const char *src
static int jacosub_decode_frame(AVCodecContext *avctx,
void *data, int *got_sub_ptr, AVPacket *avpkt)
{
+ int ret;
AVSubtitle *sub = data;
const char *ptr = avpkt->data;
@@ -176,7 +177,6 @@ static int jacosub_decode_frame(AVCodecContext *avctx,
if (*ptr) {
AVBPrint buffer;
- char *dec_sub;
// skip timers
ptr = jss_skip_whitespace(ptr);
@@ -185,9 +185,10 @@ static int jacosub_decode_frame(AVCodecContext *avctx,
av_bprint_init(&buffer, JSS_MAX_LINESIZE, JSS_MAX_LINESIZE);
jacosub_to_ass(avctx, &buffer, ptr);
- av_bprint_finalize(&buffer, &dec_sub);
- ff_ass_add_rect(sub, dec_sub, avpkt->pts, avpkt->duration, 0);
- av_free(dec_sub);
+ ret = ff_ass_add_rect_bprint(sub, &buffer, avpkt->pts, avpkt->duration, 0);
+ av_bprint_finalize(&buffer, NULL);
+ if (ret < 0)
+ return ret;
}
end: