[FFmpeg-cvslog] avcodec/libtheoraenc: Check for av_fast_realloc() failure
Michael Niedermayer
git at videolan.org
Sun Feb 22 02:37:01 CET 2015
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Feb 22 02:15:37 2015 +0100| [67d4d5f5db060fece8cc8e925f18f0a1c48813c6] | committer: Michael Niedermayer
avcodec/libtheoraenc: Check for av_fast_realloc() failure
Fixes CID1257799
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=67d4d5f5db060fece8cc8e925f18f0a1c48813c6
---
libavcodec/libtheoraenc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c
index c0074af..48f6c07 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 {
More information about the ffmpeg-cvslog
mailing list