summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-02-22 02:15:37 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-02-22 02:18:35 +0100
commit67d4d5f5db060fece8cc8e925f18f0a1c48813c6 (patch)
tree18c9869a4385ad0baca20a37e0990b401201b069
parent27216bf314c62125c408be1a5a79e5c9dba88e76 (diff)
avcodec/libtheoraenc: Check for av_fast_realloc() failure
Fixes CID1257799 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/libtheoraenc.c5
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 {