Commit 67d4d5f5 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/libtheoraenc: Check for av_fast_realloc() failure

Fixes CID1257799
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 27216bf3
...@@ -99,8 +99,11 @@ static int get_stats(AVCodecContext *avctx, int eos) ...@@ -99,8 +99,11 @@ static int get_stats(AVCodecContext *avctx, int eos)
return AVERROR_EXTERNAL; return AVERROR_EXTERNAL;
} }
if (!eos) { 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); h->stats_offset + bytes);
if (!tmp)
return AVERROR(ENOMEM);
h->stats = tmp;
memcpy(h->stats + h->stats_offset, buf, bytes); memcpy(h->stats + h->stats_offset, buf, bytes);
h->stats_offset += bytes; h->stats_offset += bytes;
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment