From patchwork Wed Nov 16 22:24:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Vignali X-Patchwork-Id: 1449 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.90.1 with SMTP id o1csp438364vsb; Wed, 16 Nov 2016 14:24:39 -0800 (PST) X-Received: by 10.28.72.198 with SMTP id v189mr499805wma.13.1479335079531; Wed, 16 Nov 2016 14:24:39 -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 c74si8980995wme.33.2016.11.16.14.24.38; Wed, 16 Nov 2016 14:24:39 -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=@gmail.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=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 04E25689E58; Thu, 17 Nov 2016 00:24:36 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yw0-f178.google.com (mail-yw0-f178.google.com [209.85.161.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 569D4689E03 for ; Thu, 17 Nov 2016 00:24:29 +0200 (EET) Received: by mail-yw0-f178.google.com with SMTP id i145so142563505ywg.2 for ; Wed, 16 Nov 2016 14:24:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=yYZA7b1AxDRFan7PRdEp/Itn6gDT2RggjLQ66fFWBAo=; b=gqtRWoe7TOkElo9BTxsCCF2D8VOBnc5OiiC4tBsjW4BhMz5V4wGTU8XXCp+6ZodFiH dq0c8vVtpWsA0VWQFfkhCFcLKVfUSPubzjivcQF5xKZ46Nqw6/xrHgUTG3Y5L4ZcjuT5 JuawBQCoRD3I//NvfA7Oc9R7eoRCe/GIfR384WBBUHi1fHSoN26eFvAgGgnXHT++Ha0R wPcFvoHmdn2olCIZn/yK74JKdEabOoAorNbYeAzSWv4BP2EifiTduYXyGdC1UuytzgWS PGHMiXKMju03qpMkZZsrwzF3ZkLDCTJVJoF/IRoYyLgaD8rkD6FkVnmPV3OcQoqmUgFU N2pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=yYZA7b1AxDRFan7PRdEp/Itn6gDT2RggjLQ66fFWBAo=; b=ZmMpYDXEiat3zCEctTpbnDMydWJILoViAYqDMtLz956yav0ckiBwwo29vgD6whctV/ PzXEx6mUBRmE5EC6/UqOoHcnACq808eKeBdXqbJFprH/zwME/SLoH7Z7ND6EjEwkH1jH Tus0l3U50njacR/PyoCSR7kPknyO4ylvda4/qacq4znDno5seO8qFm10SXVwn1V+dqhU MwOFfjMNBrap3vma+ePAmVI+ValYR9hxYaR7QNJfa4i4et6SK5zTnFQPMNMsj24OTb5i Elj8ff4XvW855WNPHXhevrSTwEuMRvsJBzl3cGZZ97MfW4R7LFbcl6qEAuA+CCOqnO+s 3LLA== X-Gm-Message-State: AKaTC031tN9RMfS1w3Yr8doWkMFRmyiSqSIWkN0Ae/JdMomNuRCVXXkcG9N1PRVhl+/YjAVJoFB/GbZJ3FTWXg== X-Received: by 10.157.3.230 with SMTP id f93mr3905703otf.4.1479335068842; Wed, 16 Nov 2016 14:24:28 -0800 (PST) MIME-Version: 1.0 Received: by 10.202.196.141 with HTTP; Wed, 16 Nov 2016 14:24:28 -0800 (PST) From: Martin Vignali Date: Wed, 16 Nov 2016 23:24:28 +0100 Message-ID: To: FFmpeg development discussions and patches , Andreas Cadhalpun X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: [FFmpeg-devel] libavcodec/exr : Fix channel size calc 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Hello, Following discussion "exr : limit expected_len to tmp buffer size" Patch in attach fix channel calc when there is uint32 channel and other kind of channel (float or half). Found by Andreas Cadhalpun I will try to make a fate test for this. Martin From 374291fae7edd403c4f827e03348f69af3b737f1 Mon Sep 17 00:00:00 2001 From: Martin Vignali Date: Wed, 16 Nov 2016 23:15:27 +0100 Subject: [PATCH] libavcodec/exr : fix channel size calculation for uint32 channel uint32 need 4 bytes not 1. Fix decoding when there is half/float and uint32 channel. --- libavcodec/exr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 51c17d6..f02337e 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -1448,7 +1448,11 @@ static int decode_header(EXRContext *s) channel->xsub = xsub; channel->ysub = ysub; - s->current_channel_offset += 1 << current_pixel_type; + if (current_pixel_type == EXR_HALF) { + s->current_channel_offset += 2; + } else {/* Float or UINT32 */ + s->current_channel_offset += 4; + } } /* Check if all channels are set with an offset or if the channels -- 1.9.3 (Apple Git-50)