diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-08-18 18:44:12 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-08-18 18:44:12 +0200 |
commit | 63c0e9077e22e63ca8524ab2519cf3b75ae9e924 (patch) | |
tree | 424376e699c8c3e95637e5f8a2bb5232cd879ffd /libavcodec | |
parent | c666c59ac1a9d78cc706fa9708c400d8bf454cda (diff) | |
download | ffmpeg-63c0e9077e22e63ca8524ab2519cf3b75ae9e924.tar.gz |
avcodec/jpeg2000dec: fix near null pointer dereference
Fixes Ticket2840
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/jpeg2000dec.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index 1eb20ac2ef..3c14a13f8e 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -1343,13 +1343,15 @@ static void jpeg2000_dec_cleanup(Jpeg2000DecoderContext *s) { int tileno, compno; for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++) { - for (compno = 0; compno < s->ncomponents; compno++) { - Jpeg2000Component *comp = s->tile[tileno].comp + compno; - Jpeg2000CodingStyle *codsty = s->tile[tileno].codsty + compno; + if (s->tile[tileno].comp) { + for (compno = 0; compno < s->ncomponents; compno++) { + Jpeg2000Component *comp = s->tile[tileno].comp + compno; + Jpeg2000CodingStyle *codsty = s->tile[tileno].codsty + compno; - ff_jpeg2000_cleanup(comp, codsty); + ff_jpeg2000_cleanup(comp, codsty); + } + av_freep(&s->tile[tileno].comp); } - av_freep(&s->tile[tileno].comp); } av_freep(&s->tile); s->numXtiles = s->numYtiles = 0; |