aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/movsub_bsf.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2014-12-18 20:26:56 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-01-15 01:25:16 +0100
commit8a9641a652ed1546fedfda22584f79d3d423096e (patch)
treec5f13c56aaadf20cece2188e509b430f6ea3061b /libavcodec/movsub_bsf.c
parent014b6b416fec89777cb9cff61bcf7896eaf7cf39 (diff)
downloadffmpeg-8a9641a652ed1546fedfda22584f79d3d423096e.tar.gz
bsf: check memory allocations
Diffstat (limited to 'libavcodec/movsub_bsf.c')
-rw-r--r--libavcodec/movsub_bsf.c4
1 files changed, 4 insertions, 0 deletions
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;
}