From patchwork Sun Jun 16 23:08:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 49965 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:9196:0:b0:460:55fa:d5ed with SMTP id s22csp1606868vqg; Sun, 16 Jun 2024 16:10:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUz1KVzWRExOu0Gm/DBJp1np/0GtTb2AzvkqcG2ByE3g6A2ivRNLLv2z/JMVe4Rzeb2Koxbt8lOh2tLb8UHeFklCcRd6HMu1gdQnw== X-Google-Smtp-Source: AGHT+IGIbIIb2UPwW3piKRQv/3BAqw9s/TA8l1DjYc82QME1XAycrrP8myOaJsaAZ2KChstlMn4b X-Received: by 2002:a2e:3a04:0:b0:2ec:170e:5b24 with SMTP id 38308e7fff4ca-2ec170e5bdemr35689261fa.4.1718579400412; Sun, 16 Jun 2024 16:10:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718579400; cv=none; d=google.com; s=arc-20160816; b=dDRNCJ6CHNyjEVkOwcsYJ2qTZYDKCCVkiqXhVT4lV1mgLf9HqGM+XWsk36hYxmJgUU 3WXbXXOCL3Dy/2hLBYg2Jv7AwVCUcQFC0r5CLTrs58udtF/+cvbkPtCbmd7nRWloARgw GqXI9zCy+xpec8qyQZulYr1Y8Qdujd5G62UTxqJbSfONRXmGcs4GdBdXAOywTDngLLRT eVRgVzUpoGkxpyExDBJ8rjyAqjnC21LtT7LSeJ8XwGGOb7ciUaP4a3x6d392kZ9OjHIR e7K8yHqeaPO2xapv3NJtYhpZfheCgCbcpZS6k5aEJm/QddBBUGzYY3WyO2ZTbEOr3ukh caQg== 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=KKbr9GAG0AyPiiPsHA3v9LeI8qhnXQMp+msC7/PwePs=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=Tgh8cShlEdNUJiMnyLiKkfZVFu9lBFCavYWRhWArreBj/+MzQ5jyQcczUTw49ZHRfw T4B8vuXyN5yMOU1JlDG1PI0+W2T/M0olkJ+PMUcysiZasoscagY4YKHSOwCRNLl7eWyN 3Ebojai4QNr3jRMtoqZJnvvhQKq7qLQNR4dW/eLVLuAlyt3jVLYRByEsAxxjtW5oJDXt 5jyDLbpXNovM8IjQQMK1zH0FFc0+gJjKKRL6oj63z6rXyCsK+P69tzimMqMzZMeMZcRE dYfmG6YHYfX+mEnP+BZfOtFO6nYLicD8i2/iWbPxuvK5+weoJ22aamlm/vvE2z6pJXWY chAg==; 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=D4OLegjo; 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-57cb79cb865si3994740a12.82.2024.06.16.16.10.00; Sun, 16 Jun 2024 16:10:00 -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=D4OLegjo; 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 161EB68D774; Mon, 17 Jun 2024 02:08:55 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4533B68D746 for ; Mon, 17 Jun 2024 02:08:41 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id A463CC0003 for ; Sun, 16 Jun 2024 23:08:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1718579320; 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=ZhkT47Mwt8xYBz9OpIq6/kyL0Nxjrrsdxz1JKfgbJGs=; b=D4OLegjoBJK3wVgIMftwUm8P7q1c4Z7zrVL+xfINbZS4xpVAwiDX0sJEy6WpHGwByq18ei Y9eUXJAYkOlttdSBkyphtXAEpR8RMwewhkkMrI73bhCgkziSTcFBonTs3dhi3wxViU6uWn iA0uhBhI0VD7pYvBSmB7YnfxR3hxg5TwzsL4rzwhWxyw2b3QKIxc009GN/EojIjucfZWo/ /GGlK0KtRiVfY3vwmO+zxDor26rq8HzKHGN50BgFymxJQBvwlA1PlYPtL64zObTkEpAwm3 PtZ+0ukGnNKru/6Itjr3A0c7XvcRez2bbSCwmlN8UOJeX5zwgibEeJpZkKCeMA== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 17 Jun 2024 01:08:31 +0200 Message-ID: <20240616230831.912377-9-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240616230831.912377-1-michael@niedermayer.cc> References: <20240616230831.912377-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 9/9] avcodec/r210enc: Use av_rescale for bitrate 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: 30JikLt7XGgx Fixes: signed integer overflow: 281612954574848 * 65344 cannot be represented in type 'long' Fixes: 68956/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_R210_fuzzer-6459074458746880 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/r210enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/r210enc.c b/libavcodec/r210enc.c index 91e34528741..ec1ebc8d609 100644 --- a/libavcodec/r210enc.c +++ b/libavcodec/r210enc.c @@ -35,7 +35,7 @@ static av_cold int encode_init(AVCodecContext *avctx) avctx->bits_per_coded_sample = 32; if (avctx->width > 0) - avctx->bit_rate = ff_guess_coded_bitrate(avctx) * aligned_width / avctx->width; + avctx->bit_rate = av_rescale(ff_guess_coded_bitrate(avctx), aligned_width, avctx->width); return 0; }