On 29 Aug 2014, at 08:31, Wolfgang Lux <wolfgang....@gmail.com> wrote:

> it is rather surprising that you didn't see this crash with another compiler 
> before. The problem is clearly in this frame:
>  #4  0x0804c4bf in +[Clock initialize] () at Clock.m:53
> The statement at that line is
>       dayWeek = [NSArray 
> arrayWithObjects:@"su",@"mo",@"tu",@"we",@"th",@"fr",@"sa"];
> The argument list lacks the nil sentinel to indicate where the list of 
> objects ends.

Given that it's in +initialize, called early on with a relatively deep stack, 
there's a good chance that the stack is zero'd when it's called, so it could 
probably work reliably for quite a while.

I wonder how difficult it would be to have mmap MAP_STACK return pages filled 
with a number other than zero, to quickly catch this kind of bug...

David

P.S. Both clang and gcc support an attribute that indicates that a variadic 
function should have a null terminator.  We can avoid this kind of error if we 
add them to our headers...

-- Sent from my brain


_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to