Re: [HACKERS] Code quality issues in ICU patch

2017-07-01 Thread Peter Eisentraut
On 6/30/17 08:13, Peter Eisentraut wrote: > On 6/24/17 11:51, Tom Lane wrote: >> Ah, I was about to suggest the same thing, but I was coming at it from >> the standpoint of not requiring buffers several times larger than >> necessary, which could in itself cause avoidable palloc failures. >> >> I

Re: [HACKERS] Code quality issues in ICU patch

2017-06-30 Thread Peter Eisentraut
On 6/24/17 11:51, Tom Lane wrote: > Ah, I was about to suggest the same thing, but I was coming at it from > the standpoint of not requiring buffers several times larger than > necessary, which could in itself cause avoidable palloc failures. > > I was going to suggest a small variant actually:

Re: [HACKERS] Code quality issues in ICU patch

2017-06-29 Thread Noah Misch
On Sun, Jun 25, 2017 at 09:28:51PM -0700, Noah Misch wrote: > On Sat, Jun 24, 2017 at 10:03:25AM -0400, Peter Eisentraut wrote: > > On 6/23/17 12:31, Tom Lane wrote: > > > icu_to_uchar() and icu_from_uchar(), and perhaps other places, are > > > touchingly naive about integer overflow hazards in

Re: [HACKERS] Code quality issues in ICU patch

2017-06-25 Thread Noah Misch
On Sat, Jun 24, 2017 at 10:03:25AM -0400, Peter Eisentraut wrote: > On 6/23/17 12:31, Tom Lane wrote: > > icu_to_uchar() and icu_from_uchar(), and perhaps other places, are > > touchingly naive about integer overflow hazards in buffer size > > calculations. I call particular attention to this bit

Re: [HACKERS] Code quality issues in ICU patch

2017-06-24 Thread Tom Lane
Peter Eisentraut writes: > On 6/23/17 12:31, Tom Lane wrote: >> icu_to_uchar() and icu_from_uchar(), and perhaps other places, are >> touchingly naive about integer overflow hazards in buffer size >> calculations. > Here is a patch that should address this. Ah,

Re: [HACKERS] Code quality issues in ICU patch

2017-06-24 Thread Peter Eisentraut
On 6/23/17 12:31, Tom Lane wrote: > icu_to_uchar() and icu_from_uchar(), and perhaps other places, are > touchingly naive about integer overflow hazards in buffer size > calculations. I call particular attention to this bit in > icu_from_uchar(): > > len_result =

Re: [HACKERS] Code quality issues in ICU patch

2017-06-23 Thread David Fetter
On Fri, Jun 23, 2017 at 12:31:40PM -0400, Tom Lane wrote: > icu_to_uchar() and icu_from_uchar(), and perhaps other places, are > touchingly naive about integer overflow hazards in buffer size > calculations. I call particular attention to this bit in > icu_from_uchar(): > > len_result =

[HACKERS] Code quality issues in ICU patch

2017-06-23 Thread Tom Lane
icu_to_uchar() and icu_from_uchar(), and perhaps other places, are touchingly naive about integer overflow hazards in buffer size calculations. I call particular attention to this bit in icu_from_uchar(): len_result = UCNV_GET_MAX_BYTES_FOR_STRING(len_uchar,