[FFmpeg-cvslog] avcodec/jpeg2000dec: Check cdx/y values more carefully

Michael Niedermayer git at videolan.org
Thu Aug 29 02:30:47 CEST 2013


ffmpeg | branch: release/2.0 | Michael Niedermayer <michaelni at gmx.at> | Wed Aug 21 04:40:50 2013 +0200| [e2eb0d23269043357cdab90a9fca4fca2895d2ac] | committer: Michael Niedermayer

avcodec/jpeg2000dec: Check cdx/y values more carefully

Some invalid values where not handled correctly in the later pixel
format matching code.
Fixes out of array accesses
Fixes Ticket2848

Found-by: Piotr Bandurski <ami_stuff at o2.pl>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 8bb11c3ca77b52e05a9ed1496a65f8a76e6e2d8f)

Conflicts:

	libavcodec/jpeg2000dec.c

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e2eb0d23269043357cdab90a9fca4fca2895d2ac
---

 libavcodec/jpeg2000dec.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 294245d..2c00a69 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -273,6 +273,11 @@ 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->cdx[i] == 3 || s->cdx[i] > 4
+            || !s->cdy[i] || s->cdy[i] == 3 || s->cdy[i] > 4) {
+            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;
     }
 



More information about the ffmpeg-cvslog mailing list