[FFmpeg-cvslog] jpeg2000: Check zero bit-plane validity
Michael Niedermayer
git at videolan.org
Wed Jul 3 14:36:19 CEST 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Jul 1 10:01:06 2013 +0200| [17e5d614a8647d51b9795cb8bccf97ee33ca2d58] | committer: Luca Barbato
jpeg2000: Check zero bit-plane validity
Prevent integer overflows.
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=17e5d614a8647d51b9795cb8bccf97ee33ca2d58
---
libavcodec/jpeg2000dec.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 83efab8..ffe97eb 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -652,10 +652,16 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s,
else if (incl < 0)
return incl;
- if (!cblk->npasses)
- cblk->nonzerobits = expn[bandno] + numgbits - 1 -
- tag_tree_decode(s, prec->zerobits + cblkno,
- 100);
+ if (!cblk->npasses) {
+ int v = expn[bandno] + numgbits - 1 -
+ tag_tree_decode(s, prec->zerobits + cblkno, 100);
+ if (v < 0) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "nonzerobits %d invalid\n", v);
+ return AVERROR_INVALIDDATA;
+ }
+ cblk->nonzerobits = v;
+ }
if ((newpasses = getnpasses(s)) < 0)
return newpasses;
if ((llen = getlblockinc(s)) < 0)
More information about the ffmpeg-cvslog
mailing list