On Thu, 2022-06-16 at 12:13 +0000, Matthias Klose wrote:
[...]
> In file included from /usr/include/string.h:519,
>                  from mines.c:12:
> In function ‘memset’,
>     inlined from ‘new_game’ at mines.c:2257:2:
> /usr/include/x86_64-linux-gnu/bits/string_fortified.h:59:10: error: 
> ‘__builtin_memset’ specified size between 18446744071562067968 and 
> 18446744073709551615 exceeds maximum object size 9223372036854775807 
> [-Werror=stringop-overflow=]
>    59 |   return __builtin___memset_chk (__dest, __ch, __len,
>       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    60 |                                  __glibc_objsize0 (__dest));
>       |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
> mines.c: In function ‘new_game’:
> mines.c:2257:29: note: destination object allocated here
>  2257 |         memset(state->layout->mines, 0, wh * sizeof(bool));
>       |                ~~~~~~~~~~~~~^~~~~~~
[...]

This warning is nonsense, isn't it?  It's claiming that memset() is the
allocation site.  And the length (wh) is the result of multiplying two
integers that have been range-checked (though not in this function).

I should patch out the use of -Werror in this package though.

Ben.

-- 
Ben Hutchings
The most exhausting thing in life is being insincere.
                                                 - Anne Morrow Lindberg

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to