From patchwork Tue May 4 21:05:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 27588 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6109:0:0:0:0:0 with SMTP id v9csp748195iob; Tue, 4 May 2021 14:11:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVJrX91Qh4R/uV8x0bDt4XfowQn64Dmius7eXkdlwnU6SbyLQ1lf81zygzrozFb3vpgX/J X-Received: by 2002:a17:906:d8d4:: with SMTP id re20mr23502348ejb.505.1620162714790; Tue, 04 May 2021 14:11:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620162714; cv=none; d=google.com; s=arc-20160816; b=v9nQ+6r4hCI59x7Y90se6AkkWCI8UyLrVuHSRjdBX4aMguli4VQOOO0y98IUIPkBvw qjCjs4T+W7B0VfkWJ89RMn2GDk9kLiuqV4S7e+C6dauWJM/faKoPZwU13fUZFoAGb1Wo Y/InKd+J3w4HFtKWeU689QUr5BiErF5rmkFY7FKGcFCvYDocG0Gb5aXND06iq6E+pmZx RrDkt1srm4rJQF09UlZ1WkfWGEb98i1w2hWLmLmA00MRFO4SlwkDPb72EoNDwB3F+vhO BbwDngXxCOKaBxDYFFFPeUi+vIUHmC5ou8zK63ur4YRSAgAGyDq5UL2CrkGYruE19d4u at2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to; bh=PQDgEkcsv9qYvB+DPR7SU1MBjjB1NXXXebpK6EH9if4=; b=OGeuWWyCXZc9miJ18EHv3W0FT8mLl6dd2y5lXgAJ8LnGa5kko7UFqngfoLnC4x60mG wIrmyi7+ZgEC2oN/JnfdSOrqc0zrv3rYHyrNoVDSt3GwQlYdh4lTf7vph2CD9qWUJdF8 T/X7pmnocOlZc40Zw5Wt1lW97EvwlvPK2/LKUvcn3zYT0wkhFe3s5XiUU2PalN7ULRWR lLd7C5DO6GhyiR33WvTDzxcNtMArGd24EdgoUbUxKCEOl7A3Q5w6Ayg0fXHZvpRAqas7 znfDI3kwBhV8qfUCsmQZ0at54zW1Xe95wqWjPEZeLrFxWCmaz8r1uDUghTyP6SYoGEIt YfOw== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id dd21si6794197edb.331.2021.05.04.14.11.54; Tue, 04 May 2021 14:11:54 -0700 (PDT) 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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E37AC6807AA; Wed, 5 May 2021 00:11:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe01-1.mx.upcmail.net (vie01a-dmta-pe01-1.mx.upcmail.net [62.179.121.154]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AFC486807AA for ; Wed, 5 May 2021 00:11:40 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe01.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1le2F3-001Zb0-0A for ffmpeg-devel@ffmpeg.org; Tue, 04 May 2021 23:06:05 +0200 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id e2E5lfjFpljeHe2E5lW7YF; Tue, 04 May 2021 23:05:05 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.3 cv=BoHjPrf5 c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=nZOtpAppAAAA:20 a=ORTaOBfH1nB5wPfDDq0A:9 a=1fhp2MxaeJtTNGEnv6mo:22 a=Z5ABNNGmrOfJ6cZ5bIyy:22 a=SsAZrZ5W_gNWK9tOzrEV:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 4 May 2021 23:05:04 +0200 Message-Id: <20210504210504.13396-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210504210504.13396-1-michael@niedermayer.cc> References: <20210504210504.13396-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfMBIde+n9G2gZzwDwxrY31pZ+008Fjo9mawh9bc+czYYlCSAmPcQpxFY1+AlwNfl+mIUX0XRFMx7kpXfTxG6xUPkSE8ZRbV8u2HomCT43WCWIso22Weg SiMMQcTQv8ynitojEIRxGZcrG73HI6f9ylvpiaHZN9Mzoim2UWpu2NF0 Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/iff: Only write palette to plane 1 if its PAL8 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: m2g8nYzZnpIc Fixes: null pointer passed as argument 1, which is declared to never be null Fixes: 33791/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5107575256383488.fuzz Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/iff.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/iff.c b/libavcodec/iff.c index b5f04e7e16..6a4c466b44 100644 --- a/libavcodec/iff.c +++ b/libavcodec/iff.c @@ -1847,7 +1847,8 @@ static int decode_frame(AVCodecContext *avctx, buf += s->planesize; } } - memcpy(frame->data[1], s->pal, 256 * 4); + if (avctx->pix_fmt == AV_PIX_FMT_PAL8) + memcpy(frame->data[1], s->pal, 256 * 4); } else if (s->ham) { int i, count = 1 << s->ham;