Re: tiny step toward threading: reduce dependence on setlocale()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, Andreas Karlsson <andreas(at)proxel(dot)se>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: tiny step toward threading: reduce dependence on setlocale()
Date: 2024-08-11 16:33:30
Message-ID: 3804933.1723394010@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jeff Davis <pgsql(at)j-davis(dot)com> writes:
> We can address those as part of a separate thread. I'll count this as
> committed.

Coverity has a nit about this:

*** CID 1616189: Null pointer dereferences (REVERSE_INULL)
/srv/coverity/git/pgsql-git/postgresql/src/backend/utils/adt/like.c: 206 in Generic_Text_IC_like()
200 * on the pattern and text, but instead call SB_lower_char on each
201 * character. In the multi-byte case we don't have much choice :-(. Also,
202 * ICU does not support single-character case folding, so we go the long
203 * way.
204 */
205
>>> CID 1616189: Null pointer dereferences (REVERSE_INULL)
>>> Null-checking "locale" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
206 if (pg_database_encoding_max_length() > 1 || (locale && locale->provider == COLLPROVIDER_ICU))
207 {
208 pat = DatumGetTextPP(DirectFunctionCall1Coll(lower, collation,
209 PointerGetDatum(pat)));
210 p = VARDATA_ANY(pat);
211 plen = VARSIZE_ANY_EXHDR(pat);

I assume it would now be okay to take out "locale &&" here?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sergei Kornilov 2024-08-11 16:54:05 Re: pg_stat_statements and "IN" conditions
Previous Message Tom Lane 2024-08-11 15:29:08 Re: Restricting Direct Access to a C Function in PostgreSQL