[PATCH 03/11] locale: Fix --enable-ubsan build failure on some ABIs

Florian Weimer fweimer@redhat.com
Tue May 20 12:59:30 GMT 2025


* 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?

Thanks,
Florian



More information about the Libc-alpha mailing list