Re: libpq stricter integer parsing - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: libpq stricter integer parsing
Date
Msg-id 20180911090002.GB31650@paquier.xyz
Whole thread Raw
In response to Re: libpq stricter integer parsing  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: libpq stricter integer parsing
List pgsql-hackers
On Sun, Sep 09, 2018 at 09:01:15AM +0200, Fabien COELHO wrote:
> Hmmm. This is what the sentence following the above tries to explain
> implicitely:
>
>   Versions of <application>libpq</application> before
>   <product>PostgreSQL 12</product> accepted trailing garbage or overflows.
>
> Maybe I can rephrase it in one sentence, eg:
>
> "From PostgreSQL 12, integer values for keywords ... are parsed strictly,
> i.e. trailing garbage and errors on overflows are not accepted
> anymore."

Okay, I am including that formulation.  I have not put yet much thoughts
into locating this in another place of the docs.  Or perhaps we could
just discard it from the final commit.

I have been reviewing your patch a bit more, and I have found an issue:
overflows are not correctly detected.  For example by specifying
something like port=5000000000 I would have expected an error but the
parsing code failed to detect that.  Values like -1 need to be accepted
though are equivalent to an unknown state when it comes to keepalive_*.

In conclusion, I finish with the simplified patch attached.  Fabien, is
that acceptable to you?
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Marina Polyakova
Date:
Subject: Re: [HACKERS] WIP Patch: Pgbench Serialization and deadlock errors
Next
From: Amit Khandekar
Date:
Subject: Re: Query is over 2x slower with jit=on