|
Message-ID: <4E1EC7DF.3070202@gmail.com> Date: Thu, 14 Jul 2011 12:41:35 +0200 From: Luka Marčetić <paxcoder@...il.com> To: musl@...ts.openwall.com Subject: Re: cluts: strerror_r() test On 07/14/2011 11:57 AM, Solar Designer wrote: > Luka, Rich - > > I've uncommented the test for strerror_r(), which you marked "glibc > fail", and it passed the test on glibc 2.3.6 for me. What exactly was > wrong with it (or rather with glibc) in your testing? > > Thanks, > > Alexander The test was uncommented yesterday morning, as I found it was my fault that it crashed, not glibc's. Actually, I think it was -O2 that helped me realize that, after I had uncommented the function. Here's the relevant diff: https://github.com/lmarcetic/cluts/commit/803ebc888ebe6656287034739229baa93376d0fc#tests/buf.c You can see that strerror_r was passed size-1, although size was not initialized (or rather, it was initialized by a test before that one). Strerror_r implementations are free to redirect a passed pointer to immutable memory if size(buflen) argument is sufficiently large. Of course, wanting to write to s[size-1] would SIGSEGV in that case. My assumption was that glibc redirected the pointer even though I gave it size-1, in which case it's incorrect behavior and it should simply copy to the provided buffer. Turns out that's not the case, and the fail was mine. Luka.
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.