Re: PATCH: CITEXT 2.0 v3 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: PATCH: CITEXT 2.0 v3
Date
Msg-id 444.1215819944@sss.pgh.pa.us
Whole thread Raw
In response to Re: PATCH: CITEXT 2.0 v3  ("David E. Wheeler" <david@kineticode.com>)
Responses Re: PATCH: CITEXT 2.0 v3  ("David E. Wheeler" <david@kineticode.com>)
List pgsql-hackers
"David E. Wheeler" <david@kineticode.com> writes:
>      lcstr = str_tolower(VARDATA_ANY(left), VARSIZE_ANY_EXHDR(left));
>      rcstr = str_tolower(VARDATA_ANY(right), VARSIZE_ANY_EXHDR(right));

>      result = varstr_cmp(
>          lcstr,
>          VARSIZE_ANY_EXHDR(left),
>          rcstr,
>          VARSIZE_ANY_EXHDR(right)
>      );

Not sure about a memory leak, but this code is clearly wrong if
str_tolower results in a change of physical string length (clearly
possible in Turkish, for instance, and probably in some other
locales too).  You need to do strlen's on the lowercased strings.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Vacuuming leaked temp tables (once again)
Next
From: "David E. Wheeler"
Date:
Subject: Re: PATCH: CITEXT 2.0 v3