From patchwork Tue Aug 20 07:50:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 51086 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:40de:b0:48e:c0f8:d0de with SMTP id lb30csp133527vqb; Tue, 20 Aug 2024 00:51:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU1PXp1npK2snwl0Qc3ewHpkr2vDMoUiVd2MZb0xGrPGKDwKglNZ/XS6U64O4Az4Yq6lswYc0TknCZJuKd98Oj52UGRexpghxwWZw== X-Google-Smtp-Source: AGHT+IHJaRTpHr4E5H9YkLNYtaft9TW8bQZOYfKetI9l4DZjxN1BAwKG4A5vWWj43PLFKpCLCtYj X-Received: by 2002:a2e:9b04:0:b0:2ec:54ec:1741 with SMTP id 38308e7fff4ca-2f3be599fb4mr77996311fa.18.1724140308899; Tue, 20 Aug 2024 00:51:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724140308; cv=none; d=google.com; s=arc-20160816; b=DhuMgogMBVUaK4IyIUwkrHRiOLQx7+b8NtjWQRD8KidNMYSEwykJDybNCiQ1LmgXI1 Tjny3T8xCp44gt4hRxkVoWmS3mHgzuM4nlGasoHPOjzJIzSv8iLUi9k+QwQhduA40Iem uFqnnnmf1jmr0mR6bZvXk4uFqhArkd6Jyy9KlgG/E/t/LNQzA5S92mcorbuwEttXa0RD iUUCLL4hxk2e0CWn615sztlu3NWgCcp2lvvpsAbaPA9Zr3q3ZqREoS//E0Yv3/YDm97I HlbdHyUhEcNVNtWNVjHUHQrrZtLV4QjrbK/7ZZ8ygOTLE9wEgZbZGC76Qr32333LF5AY CrKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=40Xf6KP9er9m7Plq74tK6BE67lvRrKCHqpPESWnG1aE=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=Q4OSuzbZap8vcZUA6wdd25T4uXbEkvTYt7LpbCMtQY+3/I/ma34AMJlQ2SYEKXhgeo 2XDnaHPpsAR0jhsrTkRp0ct751F+LkJBoOV47hkSUJU/guQ/FwmYunjzUjfkNPZ7lkfw CvrnmjWcykNJQrM26CIeyJYbymFHEMkkIGJfmXpPBJD6TVCs+N5/z/di/ND+So6vQdnf IYHSrmzTgokc5OnzyCOAFW64Ol8990luoSYafSbaVE9FO+spxo+cEfp31btY8heyBifp a/oZ+EHgnL9DCCn6+gooAHKCL2I22FHDXRp2a8a40cyltxhdjA92kE3pv7XBqHes4Sq/ Q5qA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=HK9E0XEy; 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 4fb4d7f45d1cf-5becbd51136si5671931a12.217.2024.08.20.00.51.48; Tue, 20 Aug 2024 00:51:48 -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; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=HK9E0XEy; 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 A8E3A68DD6B; Tue, 20 Aug 2024 10:51:12 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B0B9268DBF0 for ; Tue, 20 Aug 2024 10:51:03 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id E9A7BE0009 for ; Tue, 20 Aug 2024 07:51:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1724140263; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xFVJKoOANepDOYEDjFNyl5AnyEFonpfc5ger5e4CGQA=; b=HK9E0XEy4irGC4/bLF0EtRipK1L6tRcLI0YiDN3l6rFX7MQi1dva5u85zctWCUTzim8Wwc b1n6DzC47xSp6YloXSAXOK4JD6lw9oSnygKEWYFMoRuycJARDgXXVT/LTlhQ20f0az84ql 8hJ1Y7bMGMuUrHl8fZGid28PEZzj2eER3/GHKs1siA8qyXCuYnHJZKRzor5L+xcB3t4GZG aeKQYu4wqAFSJR1lX1HfqEqOlqxFSDrd45SCJQwdF+uTC3Ndrxv9rLODTfD7lDaubjKO9D FwwNWlAfhUs2J360WZRwNjj9hfAzA3Xf9XEOH+M4PF9WakD+U6iKH4OjgoumyQ== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 20 Aug 2024 09:50:56 +0200 Message-ID: <20240820075057.1735944-5-michael@niedermayer.cc> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240820075057.1735944-1-michael@niedermayer.cc> References: <20240820075057.1735944-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 5/6] tools/target_swr_fuzzer: Check av_samples_fill_arrays() for failure 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 8o9v1C7PCbm+ Fixes: use of uninitialized value Fixes: 71242/clusterfuzz-testcase-minimized-ffmpeg_SWR_fuzzer-4905557943713792 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- tools/target_swr_fuzzer.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/target_swr_fuzzer.c b/tools/target_swr_fuzzer.c index f2d8ec49c05..b6cdb72a560 100644 --- a/tools/target_swr_fuzzer.c +++ b/tools/target_swr_fuzzer.c @@ -83,6 +83,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { int in_sample_nb; int out_sample_nb = size; int count; + int ret; if (size > 128) { GetByteContext gbc; @@ -132,8 +133,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { if (!out_data) goto end; - av_samples_fill_arrays(ain , NULL, data, in_ch_count, in_sample_nb, in_sample_fmt, 1); - av_samples_fill_arrays(aout, NULL, out_data, out_ch_count, out_sample_nb, out_sample_fmt, 1); + ret = av_samples_fill_arrays(ain , NULL, data, in_ch_count, in_sample_nb, in_sample_fmt, 1); + if (ret < 0) + goto end; + ret = av_samples_fill_arrays(aout, NULL, out_data, out_ch_count, out_sample_nb, out_sample_fmt, 1); + if (ret < 0) + goto end; count = swr_convert(swr, aout, out_sample_nb, (const uint8_t **)ain, in_sample_nb);