From 8a9641a652ed1546fedfda22584f79d3d423096e Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Thu, 18 Dec 2014 20:26:56 +0100 Subject: bsf: check memory allocations --- libavcodec/movsub_bsf.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libavcodec/movsub_bsf.c') diff --git a/libavcodec/movsub_bsf.c b/libavcodec/movsub_bsf.c index 506750f12d..7b4cd62548 100644 --- a/libavcodec/movsub_bsf.c +++ b/libavcodec/movsub_bsf.c @@ -29,6 +29,8 @@ static int text2movsub(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, co if (buf_size > 0xffff) return 0; *poutbuf_size = buf_size + 2; *poutbuf = av_malloc(*poutbuf_size + FF_INPUT_BUFFER_PADDING_SIZE); + if (!*poutbuf) + return AVERROR(ENOMEM); AV_WB16(*poutbuf, buf_size); memcpy(*poutbuf + 2, buf, buf_size); return 1; @@ -46,6 +48,8 @@ static int mov2textsub(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, co if (buf_size < 2) return 0; *poutbuf_size = FFMIN(buf_size - 2, AV_RB16(buf)); *poutbuf = av_malloc(*poutbuf_size + FF_INPUT_BUFFER_PADDING_SIZE); + if (!*poutbuf) + return AVERROR(ENOMEM); memcpy(*poutbuf, buf + 2, *poutbuf_size); return 1; } -- cgit v1.2.3