[FFmpeg-cvslog] jpeg2000dec: check that we have enough components for MCT
Michael Niedermayer
git at videolan.org
Thu Jun 6 16:33:28 CEST 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Jun 6 16:06:13 2013 +0200| [21d0f75f29ca97b2ca31bd4451f488163a27e24f] | committer: Michael Niedermayer
jpeg2000dec: check that we have enough components for MCT
Fixes out of array accesses
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=21d0f75f29ca97b2ca31bd4451f488163a27e24f
---
libavcodec/jpeg2000dec.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index ca4c468..0f0259a 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -325,6 +325,11 @@ static int get_cod(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c,
tmp.nlayers = bytestream2_get_be16u(&s->g);
tmp.mct = bytestream2_get_byteu(&s->g); // multiple component transformation
+ if (tmp.mct && s->ncomponents < 3) {
+ av_log(s->avctx, "MCT %d with too few components (%d)\n", tmp.mct, s->ncomponents);
+ return AVERROR_INVALIDDATA;
+ }
+
if ((ret = get_cox(s, &tmp)) < 0)
return ret;
More information about the ffmpeg-cvslog
mailing list