From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 2D59544FEA for ; Sun, 12 May 2024 00:04:28 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B381E68D619; Sun, 12 May 2024 03:04:01 +0300 (EEST) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 15E6768D3DF for ; Sun, 12 May 2024 03:03:54 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 70F8B20002 for ; Sun, 12 May 2024 00:03:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1715472233; 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=qRMaV1KD5O3d4jiclNc6sn95WaPU2TQiOK3XK/1cQow=; b=lwa6Y33+DbsJouIYTshyH9l1aQeJ4TPoyJS/f+Q4fyXwLM9a/1nKoeUFnvt0cKiCUcYKoJ Xtk1fg2gSKavJBLl6Mz5UJLht0DKd4gVBs4ShXH0CJyq5gXiJD+ZwgXlTXhcssK4xveZT9 7bLCdZI4rrF9VpJ+tWy9eocRCBvEnejVAvMOXnEBQB91Cc62WGBp/jqx3BQXJ+HjzzuT8g 8Tc8lUrZkQTq5Cjys6prkgefpbAayEOZtI/IwiOlLjOAFUj7ToMLVSZs1k40MzoZ6Jqom7 SeHfPV4j77Gij3D2NJIUBvdzmMrFB+hxpTlrovwJEm97HqxUD4Q3q6TllQ34uw== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 12 May 2024 02:03:48 +0200 Message-ID: <20240512000349.3381912-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240512000349.3381912-1-michael@niedermayer.cc> References: <20240512000349.3381912-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 4/5] avcodec/mpegvideo_enc: Fix potential overflow in RD 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Fixes: CID1500285 Unintentional integer overflow Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavcodec/mpegvideo_enc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index b601a1a9e40..73a9082265b 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1433,7 +1433,7 @@ static int estimate_best_b_count(MpegEncContext *s) goto fail; } - rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3); + rd += (out_size * (uint64_t)lambda2) >> (FF_LAMBDA_SHIFT - 3); } /* get the delayed frames */ @@ -1442,7 +1442,7 @@ static int estimate_best_b_count(MpegEncContext *s) ret = out_size; goto fail; } - rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3); + rd += (out_size * (uint64_t)lambda2) >> (FF_LAMBDA_SHIFT - 3); rd += c->error[0] + c->error[1] + c->error[2]; -- 2.43.2 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".