Passing good info becomes bad?

Posted by Greven on Sun 29 Feb 2004 01:51 AM — 3 posts, 8,795 views.

Canada #0
Here is what my backtrace looks like:
(gdb) bt
#0  0x41fcfac1 in kill () from /lib/libc.so.6
#1  0x41fcf6eb in raise () from /lib/libc.so.6
#2  0x41fd1127 in abort () from /lib/libc.so.6
#3  0x080c3f95 in SegVio (signum=0) at comm.c:429
#4  <signal handler called>
#5  0x080cd648 in act_string(char const*, char_data*, char_data*, void*, void*) (format=0x12 <Address 0x12 out of bounds>, to=0x81e4efa, ch=0x87eb9e0, arg1=0x0, arg2=0x87e1a70) at comm.c:3827
#6  0x080cd9fe in act(short, char const*, char_data*, void*, void*, int) (AType=18, format=0x81e4efa "You stop following $N.", ch=0x87eb9e0, arg1=0x0, arg2=0x87e1a70, type=3) at comm.c:3943
#7  0x0806b8fa in stop_follower(char_data*) (ch=0x87eb9e0) at act_comm.c:2731
#8  0x0806b92e in die_follower(char_data*) (ch=0x87eb9e0) at act_comm.c:2745
#9  0x080f098b in extract_char(char_data*, bool) (ch=0x87eb9e0, fPull=true) at handler.c:1647
#10 0x0806ae04 in do_quit (ch=0x87eb9e0, argument=0x0) at act_comm.c:2419
#11 0x080f8e0e in interpret(char_data*, char*) (ch=0x87eb9e0, argument=0xb0e960c4 "") at interp.c:368
#12 0x080c4b69 in game_loop() () at comm.c:755
#13 0x080c3d63 in main (argc=8, argv=0xb0e96554) at comm.c:335
#14 0x41fbbd06 in __libc_start_main () from /lib/libc.so.6
(gdb) frame 5
#5  0x080cd648 in act_string(char const*, char_data*, char_data*, void*, void*) (format=0x12 <Address 0x12 out of bounds>, to=0x81e4efa, ch=0x87eb9e0, arg1=0x0, arg2=0x87e1a70) at comm.c:3827
3827        while ( (*point = *i) != '\0' )
(gdb) print format
$11 = 0x12 <Address 0x12 out of bounds>
(gdb) frame 6
#6  0x080cd9fe in act(short, char const*, char_data*, void*, void*, int) (AType=18, format=0x81e4efa "You stop following $N.", ch=0x87eb9e0, arg1=0x0, arg2=0x87e1a70, type=3) at comm.c:3943
3943            txt = act_string(format, to, ch, arg1, arg2);
(gdb) print format
$12 = 0x81e4efa "You stop following $N."
(gdb) 


Now, it looks like act_string is being passed a valid stringm but it is becoming corrupt by the time that it get to the next function? I can't think of a good reason why this would be. Any suggestions on tracking this down?
Amended on Sun 29 Feb 2004 01:52 AM by Greven
Australia Forum Administrator #1
It looks like you are not at the start of act_string, so I would breakpoint that, and follow through where it gets corrupted.

Some sort of buffer overrun is probably the cause.

If the bad address is always 0x12 you could do something like:

break xxxx if format == 0x12

where "xxxx" is the line number of this line:

while ( *str != '\0' )


That should show where it is getting corrupted.

Canada #2
Unfortunately, I have not been able to reproduce this problem. And even more so, my core file got overwritten because of a later crash while testing. Thanks for the help though.