![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| segmentation fault | rockgal | High Level Programming | 8 | 12-05-2006 08:16 AM |
| Segmentation Fault | compbug | UNIX for Dummies Questions & Answers | 3 | 04-21-2006 07:43 AM |
| segmentation fault | wojtyla | High Level Programming | 3 | 02-19-2005 10:53 AM |
| Segmentation fault | jshaulis | AIX | 1 | 06-01-2004 01:16 PM |
| segmentation fault | omran | High Level Programming | 2 | 08-01-2003 05:19 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Thanks!
Thanks!
I was editing the assembly code generated by "gcc -S" and I realized that: If I define in the main function a buffer as follows char[8] the first four lines in the assembly code are: pushl %ebp movl %esp, %ebp subl $8, %esp andl $-16, %esp but if I change it by char[9] I get pushl %ebp movl %esp, %ebp subl $24, %esp andl $-16, %esp and if I change it by char[17] I get pushl %ebp movl %esp, %ebp subl $40, %esp andl $-16, %esp and so on. I think the size of the stack depends on the compiler. Every 8 bytes I request, the compiler allocates 16 more. It is right?? Please tell me if I'm being stupid! Thank you very much for your support! |
| Forum Sponsor | ||
|
|
|
|||
|
In a way, I'm getting the feeling you are on the wrong track. I mean yes, you have reached useful insights about how a particular version of a particular compiler allocates and manages memory, but if as you were saying a few posts back the driver is that you need to explain to your management why you want to fix insecure code ... I'd be looking for a different employer, or hit them over the head with Smashing the Stack for Fun and Profit by Aleph One
|
|
|||
|
Let me add sth...
When some object is created say Char arr[MAX].. that is always be the part of some Segment and if the Object is occupying less than 512 bytes Then its default segment would be of 512 bytes.So for a char arr[10] bytes we can go upto 502 bytes.That is why no segment in the case. |
|
|||
|
Quote:
|
|||
| Google The UNIX and Linux Forums |