Re: libpq stricter integer parsing

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: libpq stricter integer parsing
Date: 2018-09-11 09:00:02
Message-ID: 20180911090002.GB31650@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
libpq-int-parse.patch text/x-diff 3.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Khandekar 2018-09-11 09:20:41 Re: Query is over 2x slower with jit=on
Previous Message Marina Polyakova 2018-09-11 08:44:30 Re: [HACKERS] WIP Patch: Pgbench Serialization and deadlock errors