From patchwork Fri Nov 18 21:09:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 39330 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp611799pzb; Fri, 18 Nov 2022 13:09:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf6LTQoSTmLeVK36prnJci3Y7h5bCx34vZW8SCd/rU3GKpjfCFXodaLKob91BJQA7xGtjaUb X-Received: by 2002:a05:6402:3810:b0:467:42a9:3568 with SMTP id es16-20020a056402381000b0046742a93568mr7581780edb.70.1668805773380; Fri, 18 Nov 2022 13:09:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668805773; cv=none; d=google.com; s=arc-20160816; b=CktsBrveAFJ+Puvuuu3P4DpBqfTV0PiQk3mQvzwzvGRbEd37hg251JbAMonTDmrWG0 rDWMBrbSUkP0/axgQ9tk/2ImREoDutvdJQr48rEuq8VEYESVYwEnOhdWs1hIXBJWhSXm KP6NSG3p6VosSGa5YNoxjqulDEr8REtiKGo3XAMkksUf9T5aBV1WaPiZOZez2mcM29ol uH4bzRfapmpZ4+DEVPRYxK6+4LztnkiIVAJMPsRp+3VIwShy2QZS6aR7oRjAmBFPocbQ g6DzNpXCRvOWUze1VG3N/W/6oBjOzHPyXAeEO1Qolwoc3iA/i8I/W+mwm3ZlpG1DOCby Wa3Q== 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:message-id:date:to:from:delivered-to; bh=LChNYWmodrfhyOIVSg8oXR8dQusSu2rPGGQtST4sAqQ=; b=Ep6OpKDXUXF1UB6cIS3XAIApQE+vraHTeOYp8MtbuBT9cEqZnBGz+A89M8k3IZ6d+z BjC2XKQ5JASZBLE6wPNZ8sA9Mptu6paMLY0Bij5UErqxhYnv6XpmLeeXFklUdQyiJbps iN13IUGO9QO2lSBgkvA3pVGzY0bnaRLv25tbL73IZpDNvuAv9Bd1TV7QqeYVrIUgVQ95 s+qwMNsFiJf3QaS9khvcTbI1N5v8cn8c+jwzNtFOq5Ut8HcCc8R3CtFFdPLhcTIKQUID lxtyj5L0+t7RX/cOXhRY9ZvmTtNSSw5Q1+nPpaDfipVpiuX5ojvaUYQZJxJGpPJMrukK 6Ptw== 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 p24-20020a056402501800b00461dc830100si3974933eda.452.2022.11.18.13.09.32; Fri, 18 Nov 2022 13:09:33 -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; 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 9CD6F68A607; Fri, 18 Nov 2022 23:09:28 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6A94468AA68 for ; Fri, 18 Nov 2022 23:09:21 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 560A160007 for ; Fri, 18 Nov 2022 21:09:20 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 18 Nov 2022 22:09:15 +0100 Message-Id: <20221118210918.3169-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH 1/4] avcodec/tiff: Ignore tile_count 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: x+sPgWAJhNSD Fixes: out of array access Fixes: 52427/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-4849108968144896 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/tiff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index cde318d5e5..b962dce5a2 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -994,7 +994,7 @@ static int dng_decode_tiles(AVCodecContext *avctx, AVFrame *frame, tile_count_y = (s->height + s->tile_length - 1) / s->tile_length; /* Iterate over the number of tiles */ - for (tile_idx = 0; tile_idx < s->tile_count; tile_idx++) { + for (tile_idx = 0; tile_idx < tile_count_x * tile_count_y; tile_idx++) { tile_x = tile_idx % tile_count_x; tile_y = tile_idx / tile_count_x;