How does GCC > 3.* do the padding in memory allocation?
"Rick Zhong" <[email protected]>
| Newsgroups | gmane.comp.security.programming |
|---|---|
| Message-ID | <049d01c41b2e$0a2e0450$fcce13ac@gamelink> |
hi,
I am trying the Alpha One's "Smashing The Stack For Fun And Profit". But i
realise that the new GCC compiler has add a random padding between the last
local variable and return address during the memory allocation.
For example:
void function(int a, int b, int c)
{
int z[1];
}
For for this arrray z, the gcc behave normally for z[1], z[2] , it will
allocate 4 byte for z[1], and 8 byte for z[2]. When I increase to z[3] and
z[4] the compiler will allocate 24 bytes. When z[5] is 5, it will allocate
40 bytes.
My question is how the compile do the padding? Any specific algorithm?
regards,
Rick
==========================================
Welcome to www.sinfosec.org
SINgapore <In>FOSECurity Interest Group