bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: test-getgroups.c:stringop-overflow warning on newer GCC


From: Paul Eggert
Subject: Re: test-getgroups.c:stringop-overflow warning on newer GCC
Date: Fri, 1 Jan 2021 19:33:48 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0

On 1/1/21 6:30 PM, Bernhard Voelker wrote:
As I see the same on Fedora, the issue seems to be upstream, doesn't it?

I see the problem on Fedora 33 as well. It doesn't appear to be a GCC bug. unistd.h's declaration expands to this:

extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__, __leaf__)) __attribute__ ((__access__ (__write_only__, 2, 1)));

and the "__write_only__, 2, 1" means that getgroup's 1st argument specifies the number of items in the 2nd-argument array, which means if the 1st argument is -1 the call is invalid. This checking is enabled by -Wstringop-overflow=2 which is the GCC default in 10.2.1.

I am using gcc (GCC) 10.2.1 20201125 (Red Hat 10.2.1-9).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]