Browse Source

avcodec/libtheoraenc: Check for av_fast_realloc() failure

Fixes CID1257799
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.6
Michael Niedermayer 10 years ago
parent
commit
67d4d5f5db
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      libavcodec/libtheoraenc.c

+ 4
- 1
libavcodec/libtheoraenc.c View File

@@ -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 {


Loading…
Cancel
Save