Re: libpq stricter integer parsing

2018-09-11 Thread Michael Paquier
On Tue, Sep 11, 2018 at 07:03:41PM +0200, Fabien COELHO wrote: > Attached Michael's simplified version updated with your remarks. Okay, this version looks good to me so pushed. Thanks Fabien and Peter. -- Michael signature.asc Description: PGP signature

Re: libpq stricter integer parsing

2018-09-11 Thread Fabien COELHO
+ ... I would leave this out. We don't need to document every single refinement of parsing rules. This might better belong in the release notes. Why not, I'd be fine with that. The fact that the libpq parser was quite fuzzy was not documented, the behavior was really a side effect of

Re: libpq stricter integer parsing

2018-09-11 Thread Peter Eisentraut
On 11/09/2018 11:00, Michael Paquier wrote: > diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml > index 5e7931ba90..bc7836d103 100644 > --- a/doc/src/sgml/libpq.sgml > +++ b/doc/src/sgml/libpq.sgml > @@ -1591,6 +1591,15 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname > >

Re: libpq stricter integer parsing

2018-09-11 Thread Michael Paquier
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 libpq before > PostgreSQL 12 accepted trailing garbage or overflows. > > Maybe I can rephrase it in one sentence, eg: > >

Re: libpq stricter integer parsing

2018-09-09 Thread Fabien COELHO
Hello Michael, On Fri, Sep 07, 2018 at 11:22:14PM +0200, Fabien COELHO wrote: Weird indeed. However, even if the patch applied cleanly for me, it was not compiling anymore. Attached an updated version, in which I also tried to improve the error message on trailing garbage. At least now it

Re: libpq stricter integer parsing

2018-09-08 Thread Michael Paquier
On Fri, Sep 07, 2018 at 11:22:14PM +0200, Fabien COELHO wrote: > Weird indeed. However, even if the patch applied cleanly for me, it was not > compiling anymore. Attached an updated version, in which I also tried to > improve the error message on trailing garbage. At least now it applies for me,

Re: libpq stricter integer parsing

2018-09-07 Thread Fabien COELHO
Hello Michael, Hmmm. It does apply on a test I just did right know... That's weird, it does not apply for me either with patch -p1 and there is on conflict in fe-connect.c, which looks easy enough to fix by the way. Weird indeed. However, even if the patch applied cleanly for me, it was

Re: libpq stricter integer parsing

2018-09-07 Thread Michael Paquier
On Fri, Sep 07, 2018 at 05:13:17PM +0200, Fabien COELHO wrote: > Hmmm. It does apply on a test I just did right know... That's weird, it does not apply for me either with patch -p1 and there is on conflict in fe-connect.c, which looks easy enough to fix by the way. -- Michael signature.asc

Re: libpq stricter integer parsing

2018-09-07 Thread Fabien COELHO
Hello Peter, The timeout is set to 2, and the port directive is silently ignored. However, URL parsing is stricter, eg on "port". The attached patch checks integer syntax errors and overflows, and report errors. This looks useful and the patch looks reasonable, but it doesn't apply

Re: libpq stricter integer parsing

2018-09-07 Thread Peter Eisentraut
On 17/08/2018 12:13, Fabien COELHO wrote: >sh> psql "connect_timeout=2,port=5433" > > The timeout is set to 2, and the port directive is silently ignored. > However, URL parsing is stricter, eg on "port". > > The attached patch checks integer syntax errors and overflows, and report >

libpq stricter integer parsing

2018-08-17 Thread Fabien COELHO
Follow up on a patch and discussion with Tom, currently integer parsing on keywords in libpq is quite loose, resulting in trailing garbage being ignored and allowing to hide bugs, eg: sh> psql "connect_timeout=2,port=5433" The timeout is set to 2, and the port directive is silently