ICU: check for U_STRING_NOT_TERMINATED_WARNING.
authorJeff Davis <jdavis@postgresql.org>
Wed, 17 May 2023 20:43:41 +0000 (13:43 -0700)
committerJeff Davis <jdavis@postgresql.org>
Wed, 17 May 2023 21:18:45 +0000 (14:18 -0700)
commit1c634f6647c28354258d114041252475325aea32
tree70dd674a1b46de4925248933f4b8ceec661e991e
parent6de31ce446e59a1f947c7ebe4e4bbe7ca2b842bc
ICU: check for U_STRING_NOT_TERMINATED_WARNING.

Fixes memory error in cases where the length of the language name
returned by uloc_getLanguage() is exactly ULOC_LANG_CAPACITY, in which
case the status is set to U_STRING_NOT_TERMINATED_WARNING.

Also check in call sites for other ICU functions that are expected to
return a C string to be safe (no bug is known at these other call
sites).

Reported-by: Alexander Lakhin
Discussion: https://postgr.es/m/2098874d-c111-41e4-9063-30bcf135226b@gmail.com
src/backend/utils/adt/pg_locale.c
src/bin/initdb/initdb.c