This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: strtok behaviour when uninitialized


On Mon, 12 Feb 2018, Ondřej Bílka wrote:

> > (I'd make an exception for memory copies: I think those should _all_
> > be defined by us to behave as-if by calling memmove().  Yes, really.
> > Yes, including memcpy.)
> >
> for copy abort is better, as it isn't clear if programer knew what he
> was doing and he should use memmove if he checked that overlap is ok.

In any case, we should keep the case of copying memory to itself - memcpy 
with the same source and destination address - working without any such 
abort (as far as I know that always does work in practice and compilers 
may sometimes generate such calls implicitly, so any checks disallowing 
self-copies should be limited to aggressive checking modes and only copies 
explicitly written by the user, not compiler-generated ones).  (Bug 16004 
asks for checks for overlapping copies.)

-- 
Joseph S. Myers
joseph@codesourcery.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]