bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] dfa: port to gcc -fsanitize=undefined


From: Kamil Dudka
Subject: Re: [PATCH] dfa: port to gcc -fsanitize=undefined
Date: Mon, 16 Jan 2017 19:37:18 +0100
User-agent: KMail/4.14.10 (Linux/4.8.6-gentoo; KDE/4.14.24; x86_64; ; )

On Monday, January 16, 2017 10:29:34 Eric Blake wrote:
> On 01/15/2017 08:09 PM, Paul Eggert wrote:
> > * lib/dfa.c (copy): Don’t pass NULL with size 0 to memcpy,
> > as this runs afoul of gcc -fsanitize=undefined.
> 
> It's lame that gcc warns on that usage; I'm half-tempted to propose a
> POSIX bug that various memory functions (memcpy being one of them)
> should sanely behave on a length of 0 regardless of the pointer argument
> (that is, require that implementations not dereference the pointer when
> length is 0).  But even if POSIX accepts such an improvement, we're
> still stuck working around existing compilers/system headers that warn.

Note this is not the first time this topic is discussed on bug-gnulib:

https://lists.gnu.org/archive/html/bug-gnulib/2009-05/msg00100.html

It can cause a real crash in certain execution environments.

Kamil



reply via email to

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