From patchwork Wed Jul 31 19:54:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 50838 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:12d6:0:b0:489:2eb3:e4c4 with SMTP id 205csp716345vqs; Wed, 31 Jul 2024 13:01:59 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU53oUL/zx0P4PwZeCIHpzK2L0kGeYg7y/M792tXZMBWmGpM7gpecSv3WuDI56Wo0lNAI7tSapuY0O7XKzP/JTxPYIJF424NbCrlw== X-Google-Smtp-Source: AGHT+IHfw9UDo72ApRyh+y23JZHWXWUyIygiqK3L4l0r7XkdgZGl9tNOcNHUil0JWe0oZEPXgNGi X-Received: by 2002:a05:6512:251f:b0:52e:a60e:3a0a with SMTP id 2adb3069b0e04-530b619a102mr52578e87.2.1722456118712; Wed, 31 Jul 2024 13:01:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722456118; cv=none; d=google.com; s=arc-20160816; b=EFpEq2DnILc6vt8V1dZa6EHAIcyn+P76TAUdluUP4rPHo8cTH9v58lfpwz/0uVEYhf tyCDKn8F6GxJCQIefvNBEaKpm5pj5v6UkCw+iOXgztz2fjnwZ5ECJVm0DuGL2ibBmOnA KpDlx7YCRBOxfON7gySN0Mcf0p415ssY4MSY6FolfBocL1LIRrdzzkiS0axbYSo1mPC3 5pmmXUG9lolvjJPBy1rXRpP66MqdyFxAHJI5xSBEuDef+iTZ+OaDKtz86/tz/4HVs/3G gwndsFLl/7mb+/mqwTijHjQa8Qv3yqOctJ0bmJ50ueiS0oaLG1r3Vq57vQb0CEzMON0+ cQbQ== 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=6gxXbFSZyCNy3e1OVHTbaHymzoJR4UV2/tl4XzaS584=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=pqEeMWOmvCrjfszizyWOSU1/0EdtyfQsuD3i1l57dYBMhKlcD/hcVIq8bFOVoYdi45 zpzai3uxPFqlmMvPF5EGlTwNDCK1S53wzcEkVzjuFe2jbGsz0QuukMxFFxJkcTTYKBYf 9ndY9TcdGvzRqtMhW02RW2keUMZuN4lfzB/WCg1MG680/F8i9378Cfzi4Pg63sHwaOhH 8priq6AfpiFwmoyvRPn574NM3FIqBg1Tff3RbkNKOFGrjodYRvsMyRjy79YFaK2bpJAa aAcnlZK5LF6Il961g/bmUJejj+kmoRMQMeC6SwoTR/v05HhxBHN2j1ppIxncS0EF2ZO2 oyug==; 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=k3i0O37U; 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 2adb3069b0e04-52fd5bfba4bsi4256878e87.415.2024.07.31.13.01.58; Wed, 31 Jul 2024 13:01:58 -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=k3i0O37U; 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 9D93268D903; Wed, 31 Jul 2024 22:54:22 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C9DF568BF43 for ; Wed, 31 Jul 2024 22:54:13 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 0F12240004 for ; Wed, 31 Jul 2024 19:54:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1722455653; 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=tbI3DUoCyoB9oXH1oW5LI/fwD3UCuW1O4VIwpJZWPlc=; b=k3i0O37U64D9zMHpLczQmSGVZQWglT42zcBTDeokjM4+Wqa1PlC+XkWMjE1CvQT6LyIpSv QZyeeewxaHU5u4kjnDUQv8jy+qB8UJeCbAr+Zg6gSGRrQxofyNUUtvDi+c1AIQyqj9Tqwh HRvnC5T9e7VaQhRPUtJVxgFDq3R423Ir1mCeIgKS39J4I7OxKPIX/U9d+AcqV0pYPKk5OC p0cDtQKvQfVbLc8zXUOYtOzubYvhKd9qe7YUIA0zpGcvzaJ9jAyF+W2vRophHlopGdhSaV sela21GCyTcSPO21aP8raRvY/GqL/lSnE7nv9K0DZn+i8bep1ArwV3JDTl7QJA== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 31 Jul 2024 21:54:07 +0200 Message-ID: <20240731195410.274508-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240731195410.274508-1-michael@niedermayer.cc> References: <20240731195410.274508-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 3/6] avformat/iamf_parse: Check for 0 samples 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: DJ8seB84OdDw Fixes: division by zero Fixes: 70561/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6199435013455872 Fixes: 70565/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5783790316748800 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/iamf_parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c index cdfd5f75fef..e007d6a7af2 100644 --- a/libavformat/iamf_parse.c +++ b/libavformat/iamf_parse.c @@ -252,7 +252,7 @@ static int codec_config_obu(void *s, IAMFContext *c, AVIOContext *pb, int len) if (ret < 0) goto fail; - if ((codec_config->nb_samples > INT_MAX) || + if ((codec_config->nb_samples > INT_MAX) || codec_config->nb_samples <= 0 || (-codec_config->audio_roll_distance > INT_MAX / codec_config->nb_samples)) { ret = AVERROR_INVALIDDATA; goto fail;