From patchwork Thu May 2 06:51:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13651326 Received: from fout4-smtp.messagingengine.com (fout4-smtp.messagingengine.com [103.168.172.147]) (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 932B828DC3 for ; Thu, 2 May 2024 06:51:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.147 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714632713; cv=none; b=nBqR1Jd/kGbL9pPaq1D/bTQAEZ48WOjSsXUCrN9E/FuxgLps2zF9Lf2206PIfp9TvJztuHzke6RghMAUgRJsrfPN3oNMxPX4ATQax3umTGwncWzMQWfaWdhFlpThOJS4v0C7NhvmZJkzQGYgfGAsvTnsrAtQQ10RqnJgzB+IUko= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714632713; c=relaxed/simple; bh=Zsi3P/Ka3OntghPbCcI74VWsQsYecX9nG5snxyHfOJM=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DWZ95hnGfU93vZ8ZD9rSgsSdH13ipvjmQ6caWofTnQ7Ct0mhwzqCkMV8OrBmwcJOrqLoxCdA6HhQDSO4kY/1tFw87Dk4b7iFIjEORaOlrQejPt8bwcgJMmbQAqM0JUfXi/qbaTk7yJ0W2jh4UjyP3DdEqeyv7dpObOUo2IrjA10= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none 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=I7dzE6lu; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=UOd5XHw2; arc=none smtp.client-ip=103.168.172.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none 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="I7dzE6lu"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="UOd5XHw2" Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfout.nyi.internal (Postfix) with ESMTP id B1DAB1380394 for ; Thu, 2 May 2024 02:51:50 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 02 May 2024 02:51:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=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=1714632710; x=1714719110; bh=UGjiQj9FCH ZDK9/bLNveM9hY036D08Xx3Kn/ywiZv7I=; b=I7dzE6lu5LXxur0Vb0OsmlJPI+ iysofW7IobIQhwgRIsMorK2WYmQguu5TNGHeqSWs9Qj/excelV2VEIfP2Mg4rRtr GpWapI6R0Wu/MShE3IFk3MIYpoPU8TVP89iUpHTqm933b3cX/w51ZW7fEzlJRMEN mnIt8FiSWgc9Vs/DW7dfAdstGgPzf/OtXAGvs9Ha1kSo1kRdQWjplAb/r5KEUm4c Szi+uCSRP6EbEstU/3uMxJrC5Y2ZLXKomJy4mGdYX+TwwkKBm2mNoYM+bCYvxn80 UIwhGWqeV887D2tjskW+V1ZhSFpPVIZ7Xs4fze5pJ58CwyUz3pPlcErqv8Cw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=1714632710; x=1714719110; bh=UGjiQj9FCHZDK9/bLNveM9hY036D 08Xx3Kn/ywiZv7I=; b=UOd5XHw2g+MUWPTtYVBk+YBbQwY5u+3FjjvAWBur2h/q c1kJwFtrwHQpOjB+7F/KiHfuOR4YdraeFTUvQVqMzWWjPs10rJvfkYNXgXO8Wz7P MTtMlZe6UWYssEPnMv7DXBlmTtK/n3GHcdBtOriPj0Jqf+FaBHTtid4rI+Mm7EPc /2LDJMQfrHvIAoWu9Yo9rhWeDihDWn4DKztsC64H51mWglDLMmp3l6nFY3fr/Y8C oDpQhBHcl3tVqNyCMxKxUnbfMvVCvDcgIsLqBlfmLYfYxYmzNjSN6b+HWLwI6KtB KSVjtE4mq4+rNFBjaDCdXtXtZL4Eo3Ye4zecwqF9TA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddujedgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfhfgggtuggjsehgtd erredttddvnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshes phhkshdrihhmqeenucggtffrrghtthgvrhhnpeehgefhtdefueffheekgfffudelffejtd fhvdejkedthfehvdelgfetgfdvtedthfenucevlhhushhtvghrufhiiigvpedunecurfgr rhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 2 May 2024 02:51:49 -0400 (EDT) Received: by localhost (OpenSMTPD) with ESMTPSA id bddd43f1 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Thu, 2 May 2024 06:51:24 +0000 (UTC) Date: Thu, 2 May 2024 08:51:47 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Subject: [PATCH 04/11] reftable/writer: improve error when passed an invalid block size Message-ID: 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);