From patchwork Wed Nov 16 19:56:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Cadhalpun X-Patchwork-Id: 1447 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.90.1 with SMTP id o1csp373813vsb; Wed, 16 Nov 2016 11:57:02 -0800 (PST) X-Received: by 10.194.37.6 with SMTP id u6mr2429203wjj.20.1479326222703; Wed, 16 Nov 2016 11:57:02 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id c133si8561196wme.54.2016.11.16.11.56.59; Wed, 16 Nov 2016 11:57:02 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@googlemail.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE dis=QUARANTINE) header.from=googlemail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9951A689DA9; Wed, 16 Nov 2016 21:56:57 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BB92D689950 for ; Wed, 16 Nov 2016 21:56:50 +0200 (EET) Received: by mail-wm0-f68.google.com with SMTP id a20so14618949wme.2 for ; Wed, 16 Nov 2016 11:56:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:subject:to:references:cc:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=iBjO6wCnBngaadfqQFtD2In7o2YXimQqn7jDO9f/Zeo=; b=ZJ4smuEH6DeD/QEUDM/MuBsinE4dvBAiE9ZYmQD3EE/VKrm+jFgb8ayxXTuNFnXMZW rJYZu5tT6jZcU7psf30zQasKKMFA72xS3cm4yFBEbr3hAPc3JhvUJadOeO42z+qhKLvP GdrNTcT+A2CDv5W3WDcMVrkCxQV2sKmKre+DXRBZ8qiF/M4/BZ52qbefaStxkoNUjtAZ B/L4j9SqYpqFyAyuphK2ERLIWuSpV9OuzCblgrC/Vo6X6udcvNKwGugf21/vanpE0E4G UN/CWSeF1ApcghfNYkKzEXkQYFGGKj75kT5llGc9lvTbKCGUddfJxwW4gfH6+THaBd2v hAog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:to:references:cc:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=iBjO6wCnBngaadfqQFtD2In7o2YXimQqn7jDO9f/Zeo=; b=jV87E6C7knTNdHBmgJXg17ceglmoVzg/F2ZvsGomNzlwwf5Z/K7vh2A4EZBsk4Pmq+ tEcz9ULLrG+EMhyLqpvcmCaTzpkt91OKHgC7oaT9m0P2QJCtPySiC/qcUNWII7LxME3l 8UiRrT4TBXKQcgMZkJFjbnD/BRSuhAvkASwSKyc64lo6nESRH5sirIBhub1ObOZ6hOqo Up5rPr8q/EB5aw5gLD1GJK2XU93t6tBv93aq3aAzcfvHKl0R20/HpgHr/JDlni3eweax eiEpX/BmDMzIjgMCfTPzgeqgVt2TxuymCR+QTwN2ThEMVrPpcCippzlBannpc/aYRR1C IRhA== X-Gm-Message-State: ABUngvcmCR0oCc7kgzGyk0f1ojYXcdjp5VPOi1Vk/j4zHNQv4vpRiauUE0eqG80kqtzBRQ== X-Received: by 10.28.227.215 with SMTP id a206mr13237880wmh.84.1479326211275; Wed, 16 Nov 2016 11:56:51 -0800 (PST) Received: from [192.168.2.21] (p5B072246.dip0.t-ipconnect.de. [91.7.34.70]) by smtp.googlemail.com with ESMTPSA id ab10sm9731365wjc.45.2016.11.16.11.56.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Nov 2016 11:56:50 -0800 (PST) From: Andreas Cadhalpun X-Google-Original-From: Andreas Cadhalpun To: FFmpeg development discussions and patches References: <8088a842-01e8-1efb-90fc-febaa4b34ae6@googlemail.com> Message-ID: <58f36548-f5b7-aa38-8d36-e74a1d1c402b@googlemail.com> Date: Wed, 16 Nov 2016 20:56:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 In-Reply-To: <8088a842-01e8-1efb-90fc-febaa4b34ae6@googlemail.com> Subject: [FFmpeg-devel] [PATCH 2/3] exr: fix out-of-bounds read X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Paul B Mahol , Martin Vignali Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" channel_index can be -1. This problem was introduced in commit 2dd7b46132e2801ef34fe1b5c27e0113cdcfa2f9. Signed-off-by: Andreas Cadhalpun --- libavcodec/exr.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 54869d2..bff08f2 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -1430,8 +1430,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, @@ -1440,7 +1439,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,