diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-07-03 15:20:57 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-07-03 15:28:35 +0400 |
commit | 2e85737b0e0bdc9c4d1e28dd9417370f35f8c62d (patch) | |
tree | c15cba1a649aa81f059bf5092b40a4d6ed7c2f39 /libavcodec/jpeg2000dec.c | |
parent | 838bd731393a29a41a86ff15ccf972f967306319 (diff) | |
parent | d3cb302b88503c3111e25add196622110c056188 (diff) |
Merge commit 'd3cb302b88503c3111e25add196622110c056188'
* commit 'd3cb302b88503c3111e25add196622110c056188':
jpeg2000: Validate SOT parsing
Conflicts:
libavcodec/jpeg2000dec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/jpeg2000dec.c')
-rw-r--r-- | libavcodec/jpeg2000dec.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index da0bd9cede..b6246b6837 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -463,11 +463,12 @@ static int get_sot(Jpeg2000DecoderContext *s, int n) if (bytestream2_get_bytes_left(&s->g) < 8) return AVERROR_INVALIDDATA; - s->curtileno = Isot = bytestream2_get_be16u(&s->g); // Isot - if ((unsigned)s->curtileno >= s->numXtiles * s->numYtiles) { - s->curtileno=0; + s->curtileno = 0; + Isot = bytestream2_get_be16u(&s->g); // Isot + if (Isot >= s->numXtiles * s->numYtiles) return AVERROR_INVALIDDATA; - } + + s->curtileno = Isot; Psot = bytestream2_get_be32u(&s->g); // Psot TPsot = bytestream2_get_byteu(&s->g); // TPsot @@ -478,8 +479,9 @@ static int get_sot(Jpeg2000DecoderContext *s, int n) av_log(s->avctx, AV_LOG_ERROR, "Psot %d too big\n", Psot); return AVERROR_INVALIDDATA; } - if (TPsot >= FF_ARRAY_ELEMS(s->tile[s->curtileno].tile_part)) { - av_log(s->avctx, AV_LOG_ERROR, "TPsot %d too big\n", TPsot); + + if (TPsot >= FF_ARRAY_ELEMS(s->tile[Isot].tile_part)) { + avpriv_request_sample(s->avctx, "Support for %d components", TPsot); return AVERROR_PATCHWELCOME; } |