[Bug tree-optimization/92867] Use ERF_RETURNS_ARG in more places

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Dec 9 17:21:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92867

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> ---
The "returns-argument" attribute should also be used to help detect buffer
overflow after returning from functions declared with it (either built-ins or
user-defined):

__attribute__ ((returns_arg (1))) char* f (char*);

char a[4], b[8];

void g (void)
{
  memcpy (b, f (a), sizeof b);   // reads 8 bytes from a
}


More information about the Gcc-bugs mailing list