aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-08-07 15:02:38 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-08-07 15:09:35 +0200
commit5cd57e8758e336e86698d4994ee088077869e42d (patch)
treeeb073d58d1ac4cccb02ecc25194ea8578339f4a8
parente4eab2d9bde330b9893a3291cb0d00c626a9ee8c (diff)
downloadffmpeg-5cd57e8758e336e86698d4994ee088077869e42d.tar.gz
avcodec/jpeg2000dec: check sample sepration for validity
Fixes division by 0 Fixes Ticket2841 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/jpeg2000dec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index fb4e52b238..1eb20ac2ef 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -273,6 +273,10 @@ static int get_siz(Jpeg2000DecoderContext *s)
s->sgnd[i] = !!(x & 0x80);
s->cdx[i] = bytestream2_get_byteu(&s->g);
s->cdy[i] = bytestream2_get_byteu(&s->g);
+ if (!s->cdx[i] || !s->cdy[i]) {
+ av_log(s->avctx, AV_LOG_ERROR, "Invalid sample seperation\n");
+ return AVERROR_INVALIDDATA;
+ }
log2_chroma_wh |= s->cdy[i] >> 1 << i * 4 | s->cdx[i] >> 1 << i * 4 + 2;
}