diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2011-04-24 14:49:29 +0200 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2011-04-24 18:09:33 +0200 |
commit | 67c1a59ad7f9057f86d1605df3c28db0edb99bef (patch) | |
tree | 7b7dd8656eb0c6dc519b2ad09ba26c3a7b71d3a5 /libavcodec/fraps.c | |
parent | 80da2dcf05efdaa5e8f82b635da245054256a35f (diff) | |
download | ffmpeg-67c1a59ad7f9057f86d1605df3c28db0edb99bef.tar.gz |
Check for malloc failures in fraps decoder.
Diffstat (limited to 'libavcodec/fraps.c')
-rw-r--r-- | libavcodec/fraps.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c index 1bd6fc3a21..8d40ed2fa7 100644 --- a/libavcodec/fraps.c +++ b/libavcodec/fraps.c @@ -274,6 +274,8 @@ static int decode_frame(AVCodecContext *avctx, for(i = 0; i < planes; i++){ is_chroma = !!i; av_fast_malloc(&s->tmpbuf, &s->tmpbuf_size, offs[i + 1] - offs[i] - 1024 + FF_INPUT_BUFFER_PADDING_SIZE); + if (!s->tmpbuf) + return AVERROR(ENOMEM); if(fraps2_decode_plane(s, f->data[i], f->linesize[i], avctx->width >> is_chroma, avctx->height >> is_chroma, buf + offs[i], offs[i + 1] - offs[i], is_chroma, 1) < 0) { av_log(avctx, AV_LOG_ERROR, "Error decoding plane %i\n", i); @@ -316,6 +318,8 @@ static int decode_frame(AVCodecContext *avctx, offs[planes] = buf_size; for(i = 0; i < planes; i++){ av_fast_malloc(&s->tmpbuf, &s->tmpbuf_size, offs[i + 1] - offs[i] - 1024 + FF_INPUT_BUFFER_PADDING_SIZE); + if (!s->tmpbuf) + return AVERROR(ENOMEM); if(fraps2_decode_plane(s, f->data[0] + i + (f->linesize[0] * (avctx->height - 1)), -f->linesize[0], avctx->width, avctx->height, buf + offs[i], offs[i + 1] - offs[i], 0, 3) < 0) { av_log(avctx, AV_LOG_ERROR, "Error decoding plane %i\n", i); |