summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
authorRoman Savchenko <gmstima@gmail.com>2015-05-28 18:25:57 +0300
committerMichael Niedermayer <michaelni@gmx.at>2015-05-29 00:29:58 +0200
commite5d1152ccc301c5e4345fd9e70eaab899d8a19c2 (patch)
treec4a281516b229fce7a75a5ba6820cba038eedfb8 /libavcodec/mpegvideo.c
parente85d91da48cf27a0852f5c9a676023fa08a59a7a (diff)
downloadffmpeg-e5d1152ccc301c5e4345fd9e70eaab899d8a19c2.tar.gz
avcodec/mpegvideo: Check pointer when allocation fail
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 5b9a9b90e2..5fa4cb61c5 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1045,11 +1045,14 @@ do {\
if (s1->bitstream_buffer) {
if (s1->bitstream_buffer_size +
- FF_INPUT_BUFFER_PADDING_SIZE > s->allocated_bitstream_buffer_size)
+ FF_INPUT_BUFFER_PADDING_SIZE > s->allocated_bitstream_buffer_size) {
av_fast_malloc(&s->bitstream_buffer,
&s->allocated_bitstream_buffer_size,
s1->allocated_bitstream_buffer_size);
- s->bitstream_buffer_size = s1->bitstream_buffer_size;
+ if (!s->bitstream_buffer)
+ return AVERROR(ENOMEM);
+ }
+ s->bitstream_buffer_size = s1->bitstream_buffer_size;
memcpy(s->bitstream_buffer, s1->bitstream_buffer,
s1->bitstream_buffer_size);
memset(s->bitstream_buffer + s->bitstream_buffer_size, 0,