diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-02-22 04:15:37 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-02-22 04:18:35 +0300 |
commit | 67d4d5f5db060fece8cc8e925f18f0a1c48813c6 (patch) | |
tree | 18c9869a4385ad0baca20a37e0990b401201b069 /libavcodec | |
parent | 27216bf314c62125c408be1a5a79e5c9dba88e76 (diff) |
avcodec/libtheoraenc: Check for av_fast_realloc() failure
Fixes CID1257799
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/libtheoraenc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c index c0074af652..48f6c07aee 100644 --- a/libavcodec/libtheoraenc.c +++ b/libavcodec/libtheoraenc.c @@ -99,8 +99,11 @@ static int get_stats(AVCodecContext *avctx, int eos) return AVERROR_EXTERNAL; } if (!eos) { - h->stats = av_fast_realloc(h->stats, &h->stats_size, + void *tmp = av_fast_realloc(h->stats, &h->stats_size, h->stats_offset + bytes); + if (!tmp) + return AVERROR(ENOMEM); + h->stats = tmp; memcpy(h->stats + h->stats_offset, buf, bytes); h->stats_offset += bytes; } else { |