[PATCH] string: Fix tester build with fortify enable with gcc < 12

MAHESH BODAPATI bmahi496@linux.ibm.com
Thu Aug 10 07:09:30 GMT 2023


On 10/08/23 3:04 am, Joseph Myers wrote:
> On Wed, 9 Aug 2023, bmahi496--- via Libc-alpha wrote:
>
>> From: Mahesh Bodapati<bmahi496@linux.ibm.com>
>>
>> When building with fortify enabled, GCC < 12 issues a warning on the
>> fortify strncat wrapper might overflow the destination buffer.  However,
>> GCC does not provide a specific flag to disable the warning (the
>> failure is tied to -Werror). So to avoid disable all errors, only
>> enable the check for GCC 12 or newer.
> What is the exact diagnostic message?

The error looks like below .

/In file included from ../include/bits/string_fortified.h:1,//
//                 from ../string/string.h:548,//
//                 from ../include/string.h:60,//
//                 from tester.c:41,//
//                 from inl-tester.c:6://
//In function 'strncat',//
//    inlined from 'test_strncat' at tester.c:446:13://
//../string/bits/string_fortified.h:138:10:*error: '__builtin_strncat' 
specified bound [18446744073709551600, 18446744073709551615] exceeds 
maximum object size 9223372036854775807 [-Werror=stringop-overread]*//
//  138 |   return __builtin___strncat_chk (__dest, __src, __len,//
//      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
//  139 |                                   __glibc_objsize (__dest));//
//      | ~~~~~~~~~~~~~~~~~~~~~~~~~/


>


More information about the Libc-alpha mailing list