Re: [PATCH] Reject empty string in option_parse_int()

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: joaovictor(dot)rito(at)gmail(dot)com
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Reject empty string in option_parse_int()
Date: 2026-11-19 07:00:46
Message-ID: 20261119.160046.1464977209972415178.horikyota.ntt@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

At Thu, 19 Nov 2026 00:12:02 -0300, Joao Rito <joaovictor(dot)rito(at)gmail(dot)com> wrote in
> option_parse_int() passes the argument to strtoint() and only checks
> that nothing but whitespace follows the number. For an empty or
> all-whitespace string strtoint() consumes nothing and returns 0, so the
> check passes and the option is silently accepted as 0. Report it as an invalid value, as
> is already done for other non-numeric input.

The diagnosis seems correct, and the fix looks good to me. It also
worked for me.

A quick search didn't turn up any similar issues.a

Regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Jones 2026-11-19 07:12:56 Re: Fix ISSN output truncation when the issue code is nonzero
Previous Message Ashutosh Bapat 2026-11-19 06:56:49 Re: [PATCH] Clarify CREATE INDEX IF NOT EXISTS output for invalid indexes