From patchwork Fri Nov 25 21:13:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Cadhalpun X-Patchwork-Id: 1565 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.90.1 with SMTP id o1csp588079vsb; Fri, 25 Nov 2016 13:13:24 -0800 (PST) X-Received: by 10.28.16.65 with SMTP id 62mr10162908wmq.81.1480108404209; Fri, 25 Nov 2016 13:13:24 -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 9si16063305wmp.69.2016.11.25.13.13.22; Fri, 25 Nov 2016 13:13:24 -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=NONE) header.from=googlemail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 14C216891F2; Fri, 25 Nov 2016 23:13:16 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wj0-f170.google.com (mail-wj0-f170.google.com [209.85.210.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 625D7680AE4 for ; Fri, 25 Nov 2016 23:13:09 +0200 (EET) Received: by mail-wj0-f170.google.com with SMTP id qp4so68033089wjc.3 for ; Fri, 25 Nov 2016 13:13:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=ZN3ES9r06E6TTYTJDVFjRA5f60UBrTcJFOA/JRD9Wdw=; b=GbCKvDBPxRhCn5pzyEd/g1mG5zdLcAQ0uSqnSzYIdfctep9hhsDLxakZy52mvvBaJQ DIZa6jNd4pnDFeXA6XrQnb8yhhXvlu+X/6SI0sH80W86EcN4lNrh0fwFwbwB8fZQbC+w bnU3+9ReZqA0ydDoQX8TTZLTIlexP8Htp3yiYePNZ+zA+KTYJBQUHnCTl5kFqLMOzoll PZjw4e3tvwW8WH/3IjFGU6eeP3aHjfDozLaRf2P3lhFQRSWJmO0zBL/QOCyYSIxztg7m 0iUXoep5P4vTOUMfpWZ2tH5cL8U30b6gyJqnhP24BChEab0vRvfCd98icsa9qTbSZxu5 en3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=ZN3ES9r06E6TTYTJDVFjRA5f60UBrTcJFOA/JRD9Wdw=; b=h2zBFFHWww//de5i0pwIVyCt7RVca8Lhn7Tw/XwyLeWEw5VauHiufaNoMtXNrPMDU/ MqhzcIjG0JZYz4aKHxWeesdEwkZQjsxmcevB+MKe18QCfGkzSzUtM4Q7V4aSNmm613S4 YKvG0L+Mlhrnij/5W0o6fJbD/XVN/upJBMEItrrNVJyzgElV6edCgWOv9AV0Fuv/H6eR rR7wGRPmJ3b4hg9lYlzubo9A4LykEzZ5rNSsbMDyluK60IHb5+dxWRpJ3CSvEy1TwZZe ec2DqVEJiSzGlLmdLsaMwXL5sCskQSswefjeuy5ZVk5PpE3j9/gntT3viOnixfZfD8Re ivFA== X-Gm-Message-State: AKaTC002DZeSGArZ3NJRkHC6MsvmnOFJaFwJu0cTvcxX/nSnc5cRA6xcva7/DJJnS6XJwA== X-Received: by 10.194.171.104 with SMTP id at8mr9232642wjc.159.1480108392975; Fri, 25 Nov 2016 13:13:12 -0800 (PST) Received: from [192.168.2.21] (p5B0728D8.dip0.t-ipconnect.de. [91.7.40.216]) by smtp.googlemail.com with ESMTPSA id d184sm15377047wmd.8.2016.11.25.13.13.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Nov 2016 13:13:12 -0800 (PST) From: Andreas Cadhalpun X-Google-Original-From: Andreas Cadhalpun To: FFmpeg development discussions and patches Message-ID: Date: Fri, 25 Nov 2016 22:13:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] pngdec: check if previous frame exists instead of trusting sequence_number 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" This fixes a segmentation fault caused by calling memcpy with NULL as second argument in handle_p_frame_apng. Signed-off-by: Andreas Cadhalpun --- libavcodec/pngdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 36275ae..a7b330b 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -922,7 +922,7 @@ static int decode_fctl_chunk(AVCodecContext *avctx, PNGDecContext *s, return AVERROR_INVALIDDATA; } - if (sequence_number == 0 && dispose_op == APNG_DISPOSE_OP_PREVIOUS) { + if (!s->previous_picture.f->data[0] && dispose_op == APNG_DISPOSE_OP_PREVIOUS) { // No previous frame to revert to for the first frame // Spec says to just treat it as a APNG_DISPOSE_OP_BACKGROUND dispose_op = APNG_DISPOSE_OP_BACKGROUND;