public inbox for [email protected]  
help / color / mirror / Atom feed
From: Daniel Gustafsson <[email protected]>
To: Sven Klemm <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] psql: Make ParseVariableDouble reject values above max
Date: Mon, 18 May 2026 08:41:01 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <CAMCrgp31p_5SDVi7dwnP39tTW5icQ0MWHA+N4kJdXgkL0PEy8w@mail.gmail.com>
	<[email protected]>

> On 9 May 2026, at 11:44, Daniel Gustafsson <[email protected]> wrote:
> 
>> On 8 May 2026, at 17:39, Sven Klemm <[email protected]> wrote:
>> 
>> Hello,
>> 
>>  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.
> 
> 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







reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: [PATCH] psql: Make ParseVariableDouble reject values above max
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox