From patchwork Mon Feb 20 19:29:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 40452 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp2166446pzk; Mon, 20 Feb 2023 11:29:53 -0800 (PST) X-Google-Smtp-Source: AK7set8DZDvCd1ZuT6PCxNdxchsDPCTw/VV/SQRNK/p3VcwsD4oBxuEQdRfU4VFqsCvJHS0hwfiX X-Received: by 2002:a17:906:7848:b0:877:a7ec:5ff with SMTP id p8-20020a170906784800b00877a7ec05ffmr12014439ejm.10.1676921393755; Mon, 20 Feb 2023 11:29:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676921393; cv=none; d=google.com; s=arc-20160816; b=DJLa5HsY//j0wktseSutlMdtZny3GXWipckNjiuu1DGP0n4tqbpm3E0jLm1uZRre2+ sGFVbQBOW48OFilwXI3+seiOfPVb/u6/fkhYgkrIlnmYXDAWBT52nUj4X4pduml7g8Vz unTj+Uo/yRxqZ+i3SIqLdJTcFWaztasRsd/2EAN8JULU8eL+H7/rwLSJ4uNPoW39ac0W 9a1+60bu0sTbRMn4MIrRy4lTNmAO5qu7pMpwNYTPx8GutU+se4xF1gwHdGWd+W47Rw/F S7QGzdhdncUkXi5TdV03O0fjHr0/K3ZkrrVZlSjeMKv+LJBccq+Ox9+7v9bLBHY8NkLh Bleg== 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=1VquvIz/RE1gGKrjLlQDMsHMUH0OtIXx+cA4lInwIfM=; b=orbJpNJFfVGmHmo2Qbf+P7cVCST7H65imYK08iXKQ8MtpxBm809/xMixHJk2zv2ZzL nxypL57RW0P4nr6rBLrRszcHlcadwlWPTD4TcYgdAtapRgIF/p9jEl9YxQm5ll34/ZlN FPxTmmMJIlKfa5WeyakUjMI+Uxcz1tHF4ZnE92/f77FaD1ck+xZATiTQdgFg3BKymlY2 jN2L7WEfn8G6fBA65AxdLmcoopS4rr6ffklLg/6g11Sh9aBENSS5yGGib94mU2ZwfEI4 /DBid0slNmIWweY/+mYE8rqDsw8YnV6edXOdnhm7oW3uNGSS5Xelo1AGDKY6jf1h6P2L 1Ufg== 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 19-20020a17090602d300b008d00cf8986csi5669121ejk.427.2023.02.20.11.29.53; Mon, 20 Feb 2023 11:29:53 -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 BB4B568C091; Mon, 20 Feb 2023 21:29:41 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6053E68BFEC for ; Mon, 20 Feb 2023 21:29:34 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 7DCC0240002 for ; Mon, 20 Feb 2023 19:29:33 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 20 Feb 2023 20:29:25 +0100 Message-Id: <20230220192929.4493-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230220192929.4493-1-michael@niedermayer.cc> References: <20230220192929.4493-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/6] avformat/rka: Fix 1/0 with bps=1 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: MoO/57P6lv39 Fixes: division by zero Fixes: 55940/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6333107679920128 The decoder does not support bps=1 and i have no such sample so it is not known if this duration is correct. Alternatively we could error out on all bps we currently do not support on the decoder side or not set duration. Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/rka.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/rka.c b/libavformat/rka.c index cc55480345..39e5b3bce1 100644 --- a/libavformat/rka.c +++ b/libavformat/rka.c @@ -114,7 +114,7 @@ static int rka_read_header(AVFormatContext *s) par->ch_layout.nb_channels = channels; par->sample_rate = samplerate; par->bits_per_raw_sample = bps; - st->duration = nb_samples / (channels * (bps >> 3)); + st->duration = 8LL*nb_samples / (channels * bps); if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) ff_ape_parse_tag(s);