From patchwork Fri Jul 1 19:25:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 36581 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:8b27:b0:88:1bbf:7fd2 with SMTP id l39csp1226337pzh; Fri, 1 Jul 2022 12:27:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uSlkUN2Dfo/VNHNMnpE3ziZhUY47wVTo3I/j9hSflMCczSh6zaiwuO2rK26F6cVBiLcVfM X-Received: by 2002:a17:906:a10e:b0:6f3:e70b:b572 with SMTP id t14-20020a170906a10e00b006f3e70bb572mr15969128ejy.546.1656703622679; Fri, 01 Jul 2022 12:27:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656703622; cv=none; d=google.com; s=arc-20160816; b=uek7IBSHWNaMFvdoGfKxCpdbxlo8DKHqol1YJSvYWfSGtt6gyX4VD5Y3jMqetqnHGj NIHbj4f+H8b/IrdWe1eVWBVpx/7CMxzjv2s5Bc2Aa7nhZ9p2DnIxgfyHqZxZsUdW3lBh n0MUqPn0p08fxtQQ+lgggSG5ri9qwbzH32uSIQ5KbcB2o5kfKamcEpOsqeP8RJelHebB 31gFsWiCIJobR8IdQIA3d9/sNjydr7bkUyw79OIFzjwtqbqjV2AX7kTe1UWdlqq7MNZJ czgvgDJ0zKiXfUr3Mu/Mm027xOgBUcBje2+RxjZ2XlDOuRnH42WihxaJjOFcx+N5l0qK WwGw== 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=EUoxHf1VrJwGtAXgTyYOlmdpuvemu45p5VYZC8dWy2I=; b=qpBavVQ7S6Z5ZBM8XR4G6N7F2Srkqypd9AoE4SlB58lcfn55YJfumcdKnM053/ndlh NVTWpqZr12rXv7qf0PSmmvw6bFRo3uvUp1uTL3IvE51fe4UJMbLkpQhtDLfkm0/8ybpx OhGWFeHnZUmctSPVk0bwurZGLdKYRzQSCw7JGvhd59uBQ2S157eKzy2afB3aM7w4xiLH tQsOcrDPdQPT6ghgLnqD3wqizDKHWz555LH68+p3tbjV92bimjZKICgs3i8pORJGWvQr vPpR60SoFe5X/FcRZfStirXXCTlpphGfS3b4l4/s4HHxzNjiXwW/hUijErwm1savMIhf kvUQ== 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 w12-20020a05640234cc00b004377e09fb70si26798703edc.551.2022.07.01.12.27.02; Fri, 01 Jul 2022 12:27:02 -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 7535568B800; Fri, 1 Jul 2022 22:27:00 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-at01-1.mx.upcmail.net (vie01a-dmta-at01-1.mx.upcmail.net [62.179.121.145]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6ABAA68AFBA for ; Fri, 1 Jul 2022 22:26:54 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-at01.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1o7MI2-000Hr5-1O for ffmpeg-devel@ffmpeg.org; Fri, 01 Jul 2022 21:26:54 +0200 Received: from ren-mail-psmtp-mg02. ([80.109.253.241]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id 7MHooTmtt8s8U7MI2oY6PZ; Fri, 01 Jul 2022 21:26:54 +0200 Received: from localhost ([213.47.68.29]) by ren-mail-psmtp-mg02. with ESMTP id 7MH3ohYAj8eSW7MH4omti1; Fri, 01 Jul 2022 21:25:54 +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.4 cv=KKE5sHJo c=1 sm=1 tr=0 ts=62bf4a42 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=NEAV23lmAAAA:8 a=uyVf4QPPdZlIH1_fv80A:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 1 Jul 2022 21:25:53 +0200 Message-Id: <20220701192553.12538-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220701192553.12538-1-michael@niedermayer.cc> References: <20220701192553.12538-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfF96kGB/8iirTsmdkorFCCjln2ls64RWJTawgLszllcS/jFtaULM1tsr7zE24PsNW25w0k+6+D1X4qdTNqBkBxQBdh5kRmAy/NbUmVPSrsMf6e8jhEgn /EZGbp1YMjEaTYFsuUpPF5iGbaET84fDlG7R6DjKcAxdN6CRt0BC87xGtdxem/P5LJFXAjpuai4lRg== Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/tiff: Check pixel format types for dng 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: oltbga+lbyTc Fixes: out of array access Fixes: 48271/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-6149705769287680 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/tiff.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index e4a5d3c537..bf69b083b3 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -761,6 +761,7 @@ static int tiff_unpack_strip(TiffContext *s, AVFrame *p, uint8_t *dst, int strid if (s->is_bayer) { av_assert0(width == (s->bpp * s->width + 7) >> 3); } + av_assert0(!(s->is_bayer && is_yuv)); if (p->format == AV_PIX_FMT_GRAY12) { av_fast_padded_malloc(&s->yuv_line, &s->yuv_line_size, width); if (s->yuv_line == NULL) { @@ -844,6 +845,8 @@ static int tiff_unpack_strip(TiffContext *s, AVFrame *p, uint8_t *dst, int strid av_log(s->avctx, AV_LOG_ERROR, "More than one DNG JPEG strips unsupported\n"); return AVERROR_PATCHWELCOME; } + if (!s->is_bayer) + return AVERROR_PATCHWELCOME; if ((ret = dng_decode_jpeg(s->avctx, p, s->stripsize, 0, 0, s->width, s->height)) < 0) return ret; return 0;