develooper Front page | perl.perl5.porters | Postings from March 2007

[PATCH] util.c [PATCH] perlhack.pod (Was: Re: threads crashes inTru64)

Thread Previous | Thread Next
From:
Jarkko Hietaniemi
Date:
March 26, 2007 16:50
Subject:
[PATCH] util.c [PATCH] perlhack.pod (Was: Re: threads crashes inTru64)
Message ID:
46085C33.1030601@iki.fi
I found it - calloc() for zero bytes is nonportable.  It might return
a valid pointer to the heap, or it could return NULL.  In Tru64 and AIX
it returns the latter.  (I actually fixed this same bug in Parrot not
too long ago.)  No, I didn't look at which code tried to allocate zero
bytes, but I think it was eight things each of zero bytes.

Please find attached two patches:

(1) util.c that fortifies Perl_safesyscalloc() against zero allocs
    by always calloc()ing (or malloc()ing) at least something.  I also
    added "wrap-around" guards similar to PERL_MALLOC_WRAP().

(2) adds some notes to perlhack






Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About