aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-09-13 23:22:44 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-09-13 23:25:16 +0200
commit6c07e41f43026eb65b6a4afc3119d6666781c211 (patch)
tree6112d5f8304588a2558de5918e0dcb8bf07458bc
parent23bd0335af7080bb194413c7a27d620ae659647b (diff)
downloadffmpeg-6c07e41f43026eb65b6a4afc3119d6666781c211.tar.gz
avcodec/mjpegdec: check for malloc failure of blocks[] and last_nnz[]
Fixes null pointer dereference Fixes Ticket2947 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/mjpegdec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index cca69023f9..d08818f2e2 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -507,6 +507,8 @@ unk_pixfmt:
av_freep(&s->last_nnz[i]);
s->blocks[i] = av_malloc(size * sizeof(**s->blocks));
s->last_nnz[i] = av_mallocz(size * sizeof(**s->last_nnz));
+ if (!s->blocks[i] || !s->last_nnz[i])
+ return AVERROR(ENOMEM);
s->block_stride[i] = bw * s->h_count[i];
}
memset(s->coefs_finished, 0, sizeof(s->coefs_finished));