Re: Debugging issue with -m32 program
"Mahmood Naderan via gdb" <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <[email protected]> |
No idea?
Regards,
Mahmood
On Saturday, July 7, 2018, 8:46:01 PM GMT+4:30, Mahmood Naderan via gdb <[email protected]> wrote:
Hello,
I have compiled a simple c program with -m32 option. Thing is that when I want to copy some data into an array, it crashes
Breakpoint 1, main (argc=1, argv=0xffffd154) at vuln.c:35
35 strcpy( dest, buffer );
(gdb) p &buffer[0]
$1 = 0xffffcfb5 '\220' <repeats 50 times>, "\061\300Ph//shh/bin\211\343P\211\342S\211\341\260\v̀", '\220' <repeats 37 times>, "P\336\377\377\377\177"
(gdb) p &dest[0]
$2 = 0xffffd02c "\020\334\377", <incomplete sequence \367>
(gdb) x/100x 0xffffcfb5
0xffffcfb5: 0x90909090 0x90909090 0x90909090 0x90909090
0xffffcfc5: 0x90909090 0x90909090 0x90909090 0x90909090
0xffffcfd5: 0x90909090 0x90909090 0x90909090 0x90909090
0xffffcfe5: 0xc0319090 0x2f2f6850 0x2f686873 0x896e6962
0xffffcff5: 0xe28950e3 0xb0e18953 0x9080cd0b 0x90909090
0xffffd005: 0x90909090 0x90909090 0x90909090 0x90909090
0xffffd015: 0x90909090 0x90909090 0x90909090 0x90909090
0xffffd025: 0xffffde50 0x10007fff 0x00f7ffdc 0x5cf7ffca
0xffffd035: 0xe0ffffd1 0xb7000000 0xe0f7f047 0x90f7ffdd
0xffffd045: 0x00ffffd0 0x00000000 0x00000000 0x2c000000
(gdb) next
Program received signal SIGSEGV, Segmentation fault.
0x56555655 in main (argc=<error reading variable: Cannot access memory at address 0x90909090>,
argv=<error reading variable: Cannot access memory at address 0x90909094>) at vuln.c:37
37 }
Without specifying -m32, there is no problem. I wonder why it tries to access 0x90909090. There is some problem with 32/64 bit data.
Regards,
Mahmood