diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-05-29 00:33:18 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-05-29 00:33:18 +0200 |
commit | d860084c50c310a243ece0dd0fce730d5b209003 (patch) | |
tree | 99f8446e7363f64b2043a765bb3f6f56038fec09 /libavcodec | |
parent | e5d1152ccc301c5e4345fd9e70eaab899d8a19c2 (diff) | |
download | ffmpeg-d860084c50c310a243ece0dd0fce730d5b209003.tar.gz |
avcodec/mpegvideo: Reset bitstream_buffer_size on allocation failure
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/mpeg4videodec.c | 4 | ||||
-rw-r--r-- | libavcodec/mpegvideo.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 9ef65ffc84..41caac6835 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -2670,8 +2670,10 @@ int ff_mpeg4_frame_end(AVCodecContext *avctx, const uint8_t *buf, int buf_size) av_fast_padded_malloc(&s->bitstream_buffer, &s->allocated_bitstream_buffer_size, buf_size - current_pos); - if (!s->bitstream_buffer) + if (!s->bitstream_buffer) { + s->bitstream_buffer_size = 0; return AVERROR(ENOMEM); + } memcpy(s->bitstream_buffer, buf + current_pos, buf_size - current_pos); s->bitstream_buffer_size = buf_size - current_pos; diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 5fa4cb61c5..e798565c73 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -1049,8 +1049,10 @@ do {\ av_fast_malloc(&s->bitstream_buffer, &s->allocated_bitstream_buffer_size, s1->allocated_bitstream_buffer_size); - if (!s->bitstream_buffer) + if (!s->bitstream_buffer) { + s->bitstream_buffer_size = 0; return AVERROR(ENOMEM); + } } s->bitstream_buffer_size = s1->bitstream_buffer_size; memcpy(s->bitstream_buffer, s1->bitstream_buffer, |