diff options
author | Paul B Mahol <onemda@gmail.com> | 2013-09-09 12:23:56 +0000 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2013-09-09 12:26:05 +0000 |
commit | a5615b82eb116e9fd0f71f2b03c333cc31ab706a (patch) | |
tree | dee6defe1cd05156c279be5a8809a64a6d980245 /libavcodec/eatgv.c | |
parent | 81f231b5c7c94c522561ae148adfda1ee29a2521 (diff) | |
download | ffmpeg-a5615b82eb116e9fd0f71f2b03c333cc31ab706a.tar.gz |
avcodec/eatgv: use av_reallocp_array() and check return value
Fixes #2949.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavcodec/eatgv.c')
-rw-r--r-- | libavcodec/eatgv.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c index 54074b37ff..deda86e087 100644 --- a/libavcodec/eatgv.c +++ b/libavcodec/eatgv.c @@ -169,12 +169,18 @@ static int tgv_decode_inter(TgvContext *s, AVFrame *frame, /* allocate codebook buffers as necessary */ if (num_mvs > s->num_mvs) { - s->mv_codebook = av_realloc(s->mv_codebook, num_mvs*2*sizeof(int)); + if (av_reallocp_array(&s->mv_codebook, num_mvs, sizeof(*s->mv_codebook))) { + s->num_mvs = 0; + return AVERROR(ENOMEM); + } s->num_mvs = num_mvs; } if (num_blocks_packed > s->num_blocks_packed) { - s->block_codebook = av_realloc(s->block_codebook, num_blocks_packed*16); + if (av_reallocp_array(&s->block_codebook, num_blocks_packed, sizeof(*s->block_codebook))) { + s->num_blocks_packed = 0; + return AVERROR(ENOMEM); + } s->num_blocks_packed = num_blocks_packed; } |