Commit a4a16821 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'fd54dd02'

* commit 'fd54dd02':
  jpeg2000: check len before parsing header
  jpeg2000: Check component number in get_coc() and get_qcc()

Conflicts:
	libavcodec/jpeg2000dec.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 2cad1ea2 fd54dd02
......@@ -375,7 +375,9 @@ static int get_coc(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c,
compno = bytestream2_get_byteu(&s->g);
if (compno >= s->ncomponents) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid compno %d\n", compno);
av_log(s->avctx, AV_LOG_ERROR,
"Invalid compno %d. There are %d components in the image.\n",
compno, s->ncomponents);
return AVERROR_INVALIDDATA;
}
......@@ -459,9 +461,12 @@ static int get_qcc(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q,
if (bytestream2_get_bytes_left(&s->g) < 1)
return AVERROR_INVALIDDATA;
compno = bytestream2_get_byteu(&s->g);
compno = bytestream2_get_byteu(&s->g);
if (compno >= s->ncomponents) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid compno\n");
av_log(s->avctx, AV_LOG_ERROR,
"Invalid compno %d. There are %d components in the image.\n",
compno, s->ncomponents);
return AVERROR_INVALIDDATA;
}
......@@ -1282,6 +1287,7 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
len = bytestream2_get_be16(&s->g);
if (len < 2 || bytestream2_get_bytes_left(&s->g) < len - 2)
return AVERROR_INVALIDDATA;
switch (marker) {
case JPEG2000_SIZ:
ret = get_siz(s);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment