diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-01-15 15:47:12 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-01-15 15:47:12 +0300 |
commit | c5eb725fd33ee705c3c7d674ae65bbb717bf7207 (patch) | |
tree | 27998b149b222fdb19fd20fd78b7365a7f1b731a /libavcodec/movsub_bsf.c | |
parent | 9fb5a91c66934dab395ff32eb524a3dbe08b53d8 (diff) | |
parent | 8a9641a652ed1546fedfda22584f79d3d423096e (diff) |
Merge commit '8a9641a652ed1546fedfda22584f79d3d423096e'
* commit '8a9641a652ed1546fedfda22584f79d3d423096e':
bsf: check memory allocations
Conflicts:
libavcodec/noise_bsf.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/movsub_bsf.c')
-rw-r--r-- | libavcodec/movsub_bsf.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/movsub_bsf.c b/libavcodec/movsub_bsf.c index 123c7a547d..4820b26388 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; @@ -45,6 +47,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; } |