[PATCH 03/11] locale: Fix --enable-ubsan build failure on some ABIs
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Wed May 28 19:01:14 GMT 2025
On 20/05/25 09:59, Florian Weimer wrote:
> * Adhemerval Zanella:
>
>> On mips, arc, powerpc, and s390 gcc 14 triggers the warning
>>
>> In function ‘charmap_new_char’,
>> inlined from ‘parse_charmap.isra’ at ../locale/programs/charmap.c:570:6:
>> ../locale/programs/charmap.c:1017:32: error: ‘strncmp’ specified bound [2147483649, 4294967295] exceeds maximum object size 2147483647 [-Werror=stringop-overread]
>> 1017 | if (cp == &from[len1 - 1] || strncmp (from, to, prefix_len) != 0)
>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> ../locale/programs/charmap.c:1017:32: error: ‘strncmp’ specified bound [2147483649, 4294967295] exceeds maximum object size 2147483647 [-Werror=stringop-overread]
>> cc1: all warnings being treated as errors
>>
>> So move the case to an special function and disable the sanitizer.
>
> Isn't this either a real source bug or a GCC bug? Why paper over it?
Because 1. I could not disable it with libc-diag.h because it seems that
it does not interop with -fsanitize=undefined (-fsanitize always enable
the warning), and 2. we required it to allow the module be built with
ubsan because it uses on make check to generated some locales.
An option would to build this modules without ubsan, but I think this
defeat the whole --enable-ubsan idea.
More information about the Libc-alpha
mailing list