From: Michael Niedermayer <[email protected]>

Signed-off-by: Luca Barbato <[email protected]>
Signed-off-by: Nicolas Bertrand <[email protected]>
---
 libavcodec/jpeg2kdec.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/jpeg2kdec.c b/libavcodec/jpeg2kdec.c
index 5df8a43..93b6e3c 100644
--- a/libavcodec/jpeg2kdec.c
+++ b/libavcodec/jpeg2kdec.c
@@ -267,6 +267,12 @@ static int get_cox(Jpeg2KDecoderContext *s, 
Jpeg2KCodingStyle *c)
     c->log2_cblk_width  = bytestream_get_byte(&s->buf) + 2; // cblk width
     c->log2_cblk_height = bytestream_get_byte(&s->buf) + 2; // cblk height
 
+    if (c->log2_cblk_width > 10 || c->log2_cblk_height > 10 ||
+        c->log2_cblk_width + c->log2_cblk_height > 12) {
+        av_log(s->avctx, AV_LOG_ERROR, "cblk size invalid\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     c->cblk_style = bytestream_get_byte(&s->buf);
     if (c->cblk_style != 0) { // cblk style
         av_log(s->avctx, AV_LOG_ERROR, "no extra cblk styles supported\n");
-- 
1.7.9.5

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to