aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-06-12 01:13:55 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-06-12 01:13:55 +0200
commit5ccca4eb8e1eafaa3c7bc97aec7b7131c10b3ce9 (patch)
treea7821e4cecea6af66f85727c119a49d3b8f00238
parent2f1dd4a3d11200cd25b38fa18c1a4be67f6a6aec (diff)
downloadffmpeg-5ccca4eb8e1eafaa3c7bc97aec7b7131c10b3ce9.tar.gz
avcodec/jpeg2000dec: Add some additional checking on lengthinc
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/jpeg2000dec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 6f4bd19ac3..aa6d8ecb39 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -807,6 +807,12 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s,
return newpasses;
if ((llen = getlblockinc(s)) < 0)
return llen;
+ if (cblk->lblock + llen + av_log2(newpasses) > 16) {
+ avpriv_request_sample(s->avctx,
+ "Block with length beyond 16 bits\n");
+ return AVERROR_PATCHWELCOME;
+ }
+
cblk->lblock += llen;
if ((ret = get_bits(s, av_log2(newpasses) + cblk->lblock)) < 0)
return ret;