Re: Fix empty and whitespace-only input handling in option_parse_int()

From: Raja Sai pranav <rajasaipranav0(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: li(dot)evan(dot)chao(at)gmail(dot)com
Subject: Re: Fix empty and whitespace-only input handling in option_parse_int()
Date: 2026-11-29 14:00:59
Message-ID: CAPHduZBWN6x7DY+uM0kNw3zNkmDpaJz_A5j+4NCRu_mAOrdRYw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Chao,

On Fri, Nov 27, 2026 Chao Li wrote:
> option_parse_int() doesn't handle whitespace-only strings properly. It
treats them as 0.

Thanks for the patch. I applied v1 on master (3b249c728f) and built pg_dump.

Before the patch, pg_dump --extra-float-digits= and --extra-float-digits="
" are accepted and go on to connect. After it, both fail with: invalid
value "" / " " for option --extra-float-digits. "+", "-", "5x" and "x" are
rejected before and after, and " 5" / "5 " still hit the range error, so
nothing else changes.

The endptr == optarg check looks right to me, and it doesn't depend on
strtol() setting EINVAL. I ran the binary by hand; I did not run the new
TAP tests through the test harness.

Regards,
Sai Pranav

Browse pgsql-hackers by date

  From Date Subject
Next Message Mihail Nikalayeu 2026-11-29 14:19:00 Re: Resetting snapshots during the first phase of [CREATE |RE]INDEX CONCURRENTLY
Previous Message Andrei Lepikhov 2026-11-29 13:23:21 Re: Preserve presorted ORDER BY keys when reordering DISTINCT ON keys