diff --git a/libavcodec/exr.c b/libavcodec/exr.c index c250eea423..51a8ee603c 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -1428,8 +1428,7 @@ static int decode_header(EXRContext *s) return AVERROR_PATCHWELCOME; } - if (s->channel_offsets[channel_index] == -1){/* channel have not been previously assign */ - if (channel_index >= 0) { + if (channel_index >= 0 && s->channel_offsets[channel_index] == -1) { /* channel has not been previously assigned */ if (s->pixel_type != EXR_UNKNOWN && s->pixel_type != current_pixel_type) { av_log(s->avctx, AV_LOG_ERROR, @@ -1438,7 +1437,6 @@ static int decode_header(EXRContext *s) } s->pixel_type = current_pixel_type; s->channel_offsets[channel_index] = s->current_channel_offset; - } } s->channels = av_realloc(s->channels,