At the top of my libc's malloc function there is this code
Code: Select all
7c7: e8 00 05 00 00 call ccc <_sbrk+0xa5>
7cc: 81 c3 00 00 00 00 add $0x0,%ebx
7d2: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) // <-- Inconsequential
7d9: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) // <-- Inconsequential
7e0: 8b 83 f8 ff ff ff mov -0x8(%ebx),%eax
Code: Select all
ccc: 8b 1c 24 mov (%esp),%ebx
ccf: c3 ret
Code: Select all
DYNAMIC RELOCATION RECORDS
OFFSET TYPE VALUE
000007ce R_386_32 __GLOBAL_OFFSET_TABLE_
00000a02 R_386_32 __GLOBAL_OFFSET_TABLE_
00000adc R_386_32 __GLOBAL_OFFSET_TABLE_
00000b6b R_386_32 __GLOBAL_OFFSET_TABLE_
00000c35 R_386_32 __GLOBAL_OFFSET_TABLE_
...
At each of these addresses the value is 0, so that would mean that the ebx value would be progressively incorrect as the call to 0xCCC gets further away from the image base.
Does anyone know why this is happening?, because to me this looks completely wrong, but I can't see where the error is.