On 11.08.24 18:33, Tom Lane wrote:
> Jeff Davis <pgsql@j-davis.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
leadingto 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?
Correct, that check is no longer necessary.