From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 7F2644FECD for ; Thu, 3 Jul 2025 20:13:43 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id C397868F1A0; Thu, 3 Jul 2025 23:13:11 +0300 (EEST) Received: from relay16.mail.gandi.net (relay16.mail.gandi.net [217.70.178.236]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 293B368F18E for ; Thu, 3 Jul 2025 23:13:07 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 78DC344A03 for ; Thu, 3 Jul 2025 20:13:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1751573586; 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=CxD+auG4n4FA3AjeUTxbjU+xmZsNhiqLsoExr7ZgQ8I=; b=auHx/UFTyIwyBNWdAWfPJy3Lt89/HIsRjfUKVXbiYwBkvmFp4BqCMlXMuXd6QUiHIlVzp9 kR6y4mpf4hI3L2x8e/6B0XYmbd16oEboRV00/EKwbe3kE7fGUmEVI+gakRtVugZBrw7e6N wM9od94tzclsGr8s0zlqSamRyZA7UMDXQOabqrEQORwvqTG0QOVEwqTvgGVOd9eycVRRF9 yzz5APajberoxOX/UHFcEiglBKtgtgdH04ux0fNiz3pWXDY3ug+9qb0JDeLEkYZQfs2fWk rR2rSD5zXFw+qeQtuTlB6vxki4I5TB9ovGl359lnxMefltF4DRRWtIXv3R62iA== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 3 Jul 2025 22:12:50 +0200 Message-ID: <20250703201256.3161841-8-michael@niedermayer.cc> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250703201256.3161841-1-michael@niedermayer.cc> References: <20250703201256.3161841-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-State: clean X-GND-Score: -85 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddvuddvtdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrhhlucfvnfffucdludehmdenucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofhitghhrggvlhcupfhivgguvghrmhgrhigvrhcuoehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgeqnecuggftrfgrthhtvghrnhepgeejhfetgefhgfeludegvdduvdffgeefvddtheetlefhueeitdevffevfeehhefgnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucfkphepgedurdeiiedrieeirddvvdejnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehinhgvthepgedurdeiiedrieeirddvvdejpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg Subject: [FFmpeg-devel] [PATCH 08/10] avcodec/ffv1enc: Consider variation in slice sizes 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: When splitting a 5 lines image in 2 slices one will be 3 lines and thus need more space Fixes: Assertion sc->slice_coding_mode == 0 failed at libavcodec/ffv1enc.c:1668 Fixes: 422811239/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-4933405139861504 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/ffv1enc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c index 463f46e091e..ad72906466d 100644 --- a/libavcodec/ffv1enc.c +++ b/libavcodec/ffv1enc.c @@ -1679,9 +1679,11 @@ size_t ff_ffv1_encode_buffer_size(AVCodecContext *avctx) { FFV1Context *f = avctx->priv_data; - size_t maxsize = avctx->width*avctx->height * (1 + f->transparency); + int w = avctx->width + f->num_h_slices; + int h = avctx->height + f->num_v_slices; + size_t maxsize = w*h * (1 + f->transparency); if (f->chroma_planes) - maxsize += AV_CEIL_RSHIFT(avctx->width, f->chroma_h_shift) * AV_CEIL_RSHIFT(f->height, f->chroma_v_shift) * 2; + maxsize += AV_CEIL_RSHIFT(w, f->chroma_h_shift) * AV_CEIL_RSHIFT(h, f->chroma_v_shift) * 2; maxsize += f->slice_count * 800; //for slice header if (f->version > 3) { maxsize *= f->bits_per_raw_sample + 1; -- 2.49.0 _______________________________________________ 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".