Hi there, I will try to be as explicite and specific as I can be on this issue that has raised to me recently.
Situation report:
I recently reinstalled linux on my server (Ubuntu, I was on Debian before) because I screwed up with it too much. So, now I'm back online, I recompiled the mud, though I had to installed G++, gpp, etc... so I could 'make all' and have it work, I also had to installed library missing. Everything was fixed to that level. Now, I launch the mud, it's stable and everything looks perfect. Then, boom, crash, a core file it created and I hit gdb...
Loaded symbols for /lib/tls/i686/cmov/libnss_files.so.2
#0 0x080febc7 in mprog_next_command (clist=0xbf785398 <Address 0xbf785398 out of bounds>) at mud_prog.c:156
156 while ( *pointer != '\n' && *pointer != '\0' )
(gdb) bt
#0 0x080febc7 in mprog_next_command (clist=0xbf785398 <Address 0xbf785398 out of bounds>) at mud_prog.c:156
#1 0x0810365f in mprog_driver (
com_list=0x8785398 "smile\n\rmpsleep 5\n\rsay Hello. Welcome to the Diktat's office.\n\rsay &wThe Diktat is very busy, but I'd be willing to take a message.&W&w\n\rendif\n\r", mob=0x8774348, actor=0x87726d8, obj=0x0, vo=0x0, single_step=false) at mud_prog.c:1460
#2 0x08105a4b in mpsleep_update () at mud_prog.c:1896
#3 0x0814b32a in update_handler () at update.c:2373
#4 0x080b2175 in game_loop () at comm.c:588
#5 0x080b287e in main (argc=2, argv=0xbfeb9804) at comm.c:263
Current language: auto; currently c++
(gdb)
1450 while ( TRUE )
1451 {
1452 /* With these two lines, cmnd becomes the current line from the prog,
(gdb)
1453 and command_list becomes everything after that line. */
1454 cmnd = command_list;
1455 if (!command_list) {
1456 progbug( "Command list unreadable", mob );
1457 --prog_nest;
1458 return;
1459 }
1460 command_list = mprog_next_command( command_list );
1461
1462 /* Are we at the end? */
(gdb)
1463 if ( cmnd[0] == '\0' )
1464 {
1465 if ( ifstate[iflevel][IN_IF] || ifstate[iflevel][IN_ELSE] )
1466 {
1467 progbug( "Missing endif", mob );
1468 }
1469 --prog_nest;
1470 return;
1471 }
(gdb) p tmpcmndlst
$1 = "smile\n\rmpsleep 5\n\rsay Hello. Welcome to the Diktat's office.\n\rsay &wThe Diktat is very busy, but I'd be willing to take a message.&W&w\n\rendif\n\r\000\000\000\000\000\000\000\000\000`9ڷ", '\0' <repeats 12 times>, "\021\000\000\000\224�η$\bη\000\000\021\000\005\000\000\000\000\000\000\000�\212۷\000\000\000\000�\226"...
(gdb) p command_list
$2 = 0xbf77de40 <Address 0xbf77de40 out of bounds>
(sleep_update...)
1887 mpsleep = first_mpsleep;
1888 while (mpsleep) { // Find progs to continue
1889 if (--mpsleep->timer <= 0) {
1890 current_mpsleep = mpsleep;
1891 if (mpsleep->type == MP_ROOM)
1892 rset_supermob(mpsleep->room);
1893 else if (mpsleep->type == MP_OBJ)
1894 set_supermob(mpsleep->obj);
1895 mprog_driver(mpsleep->com_list, mpsleep->mob, mpsleep->actor,
1896 mpsleep->obj, mpsleep->vo, mpsleep->single_step);
(gdb)
1897 release_supermob();
1898 tmpMpsleep = mpsleep;
1899 mpsleep = mpsleep->next;
1900 STRFREE(tmpMpsleep->com_list);
1901 UNLINK(tmpMpsleep, first_mpsleep, last_mpsleep, next, prev);
1902 DISPOSE(tmpMpsleep);
1903 continue;
1904 }
1905 mpsleep = mpsleep->next;
1906 }
(gdb) set print pretty
(gdb) p *mpsleep
Cannot access memory at address 0xffffffe8
(gdb) p first_mpsleep
$3 = (MPSLEEP_DATA *) 0x877faa8
(gdb) p *first_mpsleep
$4 = {
next = 0x0,
prev = 0x0,
timer = 0,
type = MP_MOB,
room = 0x0,
ignorelevel = 0,
iflevel = 1,
ifstate = {{false, false, false, false}, {true, false, false, false}, {
false, false, false, false} <repeats 18 times>},
com_list = 0x8785398 "smile\n\rmpsleep 5\n\rsay Hello. Welcome to the Diktat's office.\n\rsay &wThe Diktat is very busy, but I'd be willing to take a message.&W&w\n\rendif\n\r",
mob = 0x8774348,
actor = 0x87726d8,
obj = 0x0,
vo = 0x0,
single_step = false
}
Sometimes, msleep is ok, com_list also, but Command_List always is the one with the address out of bound problem in all cases I've seen up to now. I've been trying to add if checks to avoid crashing, but can't seems to find a way to prevent it. So, if anyone has any idea how I can fix this, that would be a great help.
Thank you for your time.
Aramis. |