Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wP05u-000L58-1l for pgsql-hackers@arkaria.postgresql.org; Mon, 18 May 2026 15:41:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wP05s-002gA5-07 for pgsql-hackers@arkaria.postgresql.org; Mon, 18 May 2026 15:41:24 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wP05r-002g9w-27 for pgsql-hackers@lists.postgresql.org; Mon, 18 May 2026 15:41:24 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wP05o-00000000Bwq-3LMG for pgsql-hackers@lists.postgresql.org; Mon, 18 May 2026 15:41:23 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id 8D14A60F8C0 for ; Mon, 18 May 2026 17:41:17 +0200 (CEST) Received: from s934.loopia.se (unknown [172.22.191.6]) by s807.loopia.se (Postfix) with ESMTP id 72C5D53040B; Mon, 18 May 2026 17:41:17 +0200 (CEST) Received: from localhost (unknown [172.22.191.6]) by s934.loopia.se (Postfix) with ESMTP id 6850DA3D610; Mon, 18 May 2026 17:41:17 +0200 (CEST) X-Virus-Scanned: amavis at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1.2 X-Spam-Level: X-Spam-Status: No, score=-1.2 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1] autolearn=disabled Authentication-Results: s471.loopia.se (amavis); dkim=pass (2048-bit key) header.d=yesql.se Received: from s980.loopia.se ([172.22.191.6]) by localhost (s471.loopia.se [172.22.190.35]) (amavis, port 10024) with LMTP id P366BMnsX9sB; Mon, 18 May 2026 17:41:16 +0200 (CEST) X-Loopia-Auth: user X-Loopia-User: daniel@yesql.se X-Loopia-Originating-IP: 69.196.93.195 Received: from smtpclient.apple (unknown [69.196.93.195]) (Authenticated sender: daniel@yesql.se) by s980.loopia.se (Postfix) with ESMTPSA id 7FFD0220169A; Mon, 18 May 2026 17:41:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yesql.se; s=loopiadkim1707475645; t=1779118876; bh=0qgjJWhi/zWmMqCWiapIoQx1VsoKwkI1cDGHTfbPOcU=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=QfrePs5R6qDpsDnGjp0aaBKJvG/tz0rl2slkOir5nifB3zn8q9N3TrE6s88Ol4scr iTq42AEG2HYhMe3fU8iB3wemFpzElglP7RDOOG1w71mLmFr9SMqK+t2C5jF0lZzmUm Nq4Wr0PuAiMmozlkmhSyEqE4hz4xRhFtff+cQeetbz/LQTHkELS83Sas+es5T40Bxa FT0tMr6AGSxfhCn5fC0ZszhCaO0sde+4HVmvg+ypRGb887S9NF/fpTnGumn0kHjrNl kVz68Cpa5mGCuE2SSVGlq82z/H4U6gvN0Y6e66aHHJiOU8KDT7nC0PbSx096ODN5Pn L2XsSKqV1Ykfg== Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51.11.12\)) Subject: Re: [PATCH] psql: Make ParseVariableDouble reject values above max From: Daniel Gustafsson In-Reply-To: Date: Mon, 18 May 2026 08:41:01 -0700 Cc: pgsql-hackers@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Sven Klemm X-Mailer: Apple Mail (2.3776.700.51.11.12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 9 May 2026, at 11:44, Daniel Gustafsson wrote: >=20 >> On 8 May 2026, at 17:39, Sven Klemm wrote: >>=20 >> Hello, >>=20 >> ParseVariableDouble() in src/bin/psql/variables.c is asymmetric in = how >> it handles the [min, max] bounds it documents. The lower-bound = branch >> correctly returns false, but the upper-bound branch logs the error = and >> then falls through to assign *result and return true. The function's >> contract ("the value must be within the range [min,max] in order to = be >> considered valid"; "if unsuccessful, *result isn't clobbered") is >> broken on the upper-bound path. >=20 > Indeed, that's a silly bug, not sure how I could have missed that. We = are > currently in freeze for the upcoming minor releases but I have this = staged to > go in directly after. Thanks for the report. Pushed and backpatched to v18, with the addition of a test for this = behaviour. -- Daniel Gustafsson