Browse Source

jpeg2000: Check code-block size

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Signed-off-by: Nicolas Bertrand <nicoinattendu@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
tags/n2.0
Michael Niedermayer Luca Barbato 12 years ago
parent
commit
fbcc03db8f
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      libavcodec/jpeg2000dec.c

+ 6
- 0
libavcodec/jpeg2000dec.c View File

@@ -267,6 +267,12 @@ static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c)
c->log2_cblk_width = bytestream_get_byte(&s->buf) + 2; // cblk width c->log2_cblk_width = bytestream_get_byte(&s->buf) + 2; // cblk width
c->log2_cblk_height = bytestream_get_byte(&s->buf) + 2; // cblk height 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); c->cblk_style = bytestream_get_byte(&s->buf);
if (c->cblk_style != 0) { // cblk style if (c->cblk_style != 0) { // cblk style
av_log(s->avctx, AV_LOG_ERROR, "no extra cblk styles supported\n"); av_log(s->avctx, AV_LOG_ERROR, "no extra cblk styles supported\n");


Loading…
Cancel
Save