Mailing List Archive

Support open source code!


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

Re: tlug: gcc question



>>>>> "Fredric" == Fredric Fredricson <Fredric.Fredriksson@example.com> writes:

    Fredric> I doubt this will happen because the malloc() call will
    Fredric> request a full page from the kernel so you will get no
    Fredric> SIGSEGV until you reach the end of that page.

Well, actually, who knows?  Under the old GNU malloc, you'd get blocks
that were powers of 2, so with "malloc(80)" you'd get 128 bytes, which
could just happen to be at the end of allocated memory.  28 extra
characters to SIGSEGV.

OTOH, on a new block on a machine with bigger than 16 bit ints, malloc
grabs blocks of 2048 bytes.  And if you're really lucky, you could
allocate your 80 byte buffer into the beginning of that 1GB buffer
that just got free'd.  ;-)  That'd take a while to overrun!

Anybody know how Doug Lea's malloc (the one glibc uses AFAIK) works?

BTW, is there any truth to the rumor that in "safe" mode, Windows
malloc returns a pointer to ROM, thus preventing all buffer overruns?

-- 
University of Tsukuba                Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Institute of Policy and Planning Sciences       Tel/fax: +81 (298) 53-5091
/* What's the big deal about the millennium? .............................
.... There are still 360 shopping days left until the millennial epoch! */
-------------------------------------------------------------------
Next Technical Meeting: January 14 (Fri) 19:00
* Topic: "glibc - current status and future developments"
* Guest Speaker: Ulrich Drepper (Cygnus Solutions)
* Place: Oracle Japan HQ 12F Seminar Room (New Otani Garden Court)
-------------------------------------------------------------------
more info: http://www.tlug.gr.jp        Sponsor: Global Online Japan


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links