]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/exr: Check for duplicate channel index
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 25 Dec 2018 17:41:58 +0000 (18:41 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 12 Jan 2019 15:46:41 +0000 (16:46 +0100)
Fixes: Out of memory
Fixes: 11582/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5730204559867904
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/exr.c

index 5253cc3f136c7ffd32ad726acc73f721a6ca8a1c..13755e1e6eec2302d3606a97935318c97609d97b 100644 (file)
@@ -1463,6 +1463,11 @@ static int decode_header(EXRContext *s, AVFrame *frame)
                     }
                     s->pixel_type                     = current_pixel_type;
                     s->channel_offsets[channel_index] = s->current_channel_offset;
+                } else if (channel_index >= 0) {
+                    av_log(s->avctx, AV_LOG_ERROR,
+                            "Multiple channels with index %d.\n", channel_index);
+                    ret = AVERROR_INVALIDDATA;
+                    goto fail;
                 }
 
                 s->channels = av_realloc(s->channels,