From patchwork Fri May 10 10:29:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13661276 Received: from wfhigh1-smtp.messagingengine.com (wfhigh1-smtp.messagingengine.com [64.147.123.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D932F16D4D6 for ; Fri, 10 May 2024 10:29:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.152 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715336981; cv=none; b=Cm9Tb/Q/UrQWc2RlSVmz9AmCckSlevtmOs4gOfV1HmQGp3mzac0SupX3OGUwUuYYKzFDoo9RZwvkcCtjnVKxYw/W7jKWmKKPlFwo1YTQjdNBuv4jffRd828FPsYdtjuchnT7DOxnLLE7XV+o2wzfgRfZ5i5WZZzXIoLiGwCJFi4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715336981; c=relaxed/simple; bh=bTdvNkhNt1Dd7R0p9HaQQbZdFDtQm/dZCQoz4i4yAsw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uSYeNMgmVDwfvJf7zlStlm8XaoGkB0UQ+c7rQ3aGPWp3+q391sMLJwquuphymMXX0/TsEEVc9odqjRCPHJ1OTV7r8yjeUZnOzezEa37OXUGvL5+VnNI2iyVxRCzdRS0T2i/TxfQY7XbBmdr5x/79amaUHHwcYV0S3Mpu8CX1T3s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=vBVIFC2m; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Xul7QzvC; arc=none smtp.client-ip=64.147.123.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="vBVIFC2m"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Xul7QzvC" Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfhigh.west.internal (Postfix) with ESMTP id EDFFB180008D; Fri, 10 May 2024 06:29:38 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 10 May 2024 06:29:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1715336978; x=1715423378; bh=f4lcxOJ8s7 yfqr9ikE6inqnuBR2tNzMVz4kWzHwA7Z8=; b=vBVIFC2miCbv0QVYfpiF2tbJV0 mY3zhNUl8ScYn9hOpaGYrZU/LwolS2DJDuX/MU3CfT3zeh2XIuW5u84tgUC9sWzl iAkf4F0LQdNKe4w3gPt4JiFG1BHGvsGyJZAofsB0ZXQi7XUW13O0/4RSpYqZEz1n YsDSeCwCnElUthkCMcywSQc12q+P7XnqUkMVm6Fp/b9b7M8LeAz+1w4e6Sss9btY ojTcsj7BhMqv/lwthAQVaVAWju/X2sj/C3gdzgQB57W5w06Z3XsPyk+1ADiRWt6c o+9Rcfm5PsInOpR9JRTXkNX2tU7NWze/Brqh67LgTcUqd/SJfa5SIUfLV0qg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1715336978; x=1715423378; bh=f4lcxOJ8s7yfqr9ikE6inqnuBR2t NzMVz4kWzHwA7Z8=; b=Xul7QzvC19xPfpJsNJq51u6YAxH5X/3/aeGIY2qNkj3+ n1HBkZsKZVMhQXXM5oOd8om8UbE7pK5IVG3/b5Bb8yCtMRbCxyQfGXOxJkPrBENe nIDhVco+wEa1PTtreS4VrQZRWhNkozf9DltCDaRmIXdfY9pceFnlB4FWTYb6UKPI 3CPL6iYxm+HMXncbKOWLnvouKP1P8BNseIU/ijpkc84HrCuOpY9CW/3dvi0fvNHR wxD1aJAQz+j3NDckF37Wg/mXy1ei6czHsBsgy2giXKGvJLDhOg9C9zlludVkLvpV thnchfoutrAAdHHM5l56gRlWZWb8KWDwtYKCCjJbIQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdefkedgvdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvdenucfhrhhomheprfgrthhr ihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvg hrnhepueektdevtdffveeljeetgfehheeigeekleduvdeffeeghefgledttdehjeelffet necuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepphhsse hpkhhsrdhimh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 10 May 2024 06:29:37 -0400 (EDT) Received: by localhost (OpenSMTPD) with ESMTPSA id 652b5fa0 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 10 May 2024 10:29:25 +0000 (UTC) Date: Fri, 10 May 2024 12:29:35 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Karthik Nayak , Justin Tobler Subject: [PATCH v2 04/11] reftable/writer: improve error when passed an invalid block size Message-ID: <5e7cbb7b193c578f7c946a5077a79421b0ac57f2.1715336798.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: The reftable format only supports block sizes up to 16MB. When the writer is being passed a value bigger than that it simply calls abort(3P), which isn't all that helpful due to the lack of a proper error message. Improve this by calling `BUG()` instead. Signed-off-by: Patrick Steinhardt --- reftable/writer.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/reftable/writer.c b/reftable/writer.c index 7df6e53699..374b7d15ed 100644 --- a/reftable/writer.c +++ b/reftable/writer.c @@ -125,10 +125,8 @@ reftable_new_writer(ssize_t (*writer_func)(void *, const void *, size_t), struct reftable_writer *wp = reftable_calloc(1, sizeof(*wp)); options_set_defaults(&opts); - if (opts.block_size >= (1 << 24)) { - /* TODO - error return? */ - abort(); - } + if (opts.block_size >= (1 << 24)) + BUG("configured block size exceeds 16MB"); strbuf_init(&wp->block_writer_data.last_key, 0); strbuf_init(&wp->last_key, 0);