Welcome to the Builder Academy

Question Hedit Crash

More
16 Jul 2014 10:32 #4956 by WhiskyTest
Hedit Crash was created by WhiskyTest
Hi guys,

I've been fiddling about with helpfiles - I wasn't able to save them and found this bug(?):
hedit save would try and edit the helpfile called save, rather than saving the helpfiles :)
Code:
in hedit.c ACMD(do_oasis_hedit) ... if (!*arg) { send_to_char(ch, "Please specify a help entry to edit.\r\n"); return; } d = ch->desc; - if (!str_cmp("save", argument)) { + if (!str_cmp("save", arg)) {

But the crash I've been reproducing is when I want to create a new help entry at runtime. In this example 'hedit old' to make a new help entry called 'old'. GDB output below..
Code:
Jul 16 22:28:00 :: Matt (level 34) has 2 objects (max 30). [New Thread 6068.0xbfc] [New Thread 6068.0x19f0] [New Thread 6068.0x13b0] Jul 16 22:28:27 :: Matt tried to get help on old Program received signal SIGSEGV, Segmentation fault. 0x00000001004ab239 in do_oasis_hedit (ch=0x6001fea90, argument=<optimized out>, cmd=<optimized out>, subcmd=<optimized out>) at hedit.c:90 warning: Source file is more recent than executable. 90 if (help_table[i].duplicate == 0 && help_table[i].entry == help_table[OLC_ZNUM(d)].entry) { (gdb) bt #0 0x00000001004ab239 in do_oasis_hedit (ch=0x6001fea90, argument=<optimized out>, cmd=<optimized out>, subcmd=<optimized out>) at hedit.c:90 #1 0x0000000100480ab4 in command_interpreter (ch=0x6001fea90, argument=argument@entry=0x22a380 "hedit old") at interpreter.c:590 #2 0x00000001004e432d in game_loop (local_mother_desc=3) at comm.c:890 #3 0x0000000100505e1f in init_game (local_port=4000) at comm.c:534 #4 main (argc=<optimized out>, argv=<optimized out>) at comm.c:354 (gdb) list 85 OLC_ZNUM(d) = search_help(OLC_STORAGE(d), LVL_IMPL); 86 87 if (help_table[OLC_ZNUM(d)].duplicate) 88 { 89 for (i = 0; i < top_of_helpt; i++) 90 if (help_table[i].duplicate == 0 && help_table[i].entry == help_table[OLC_ZNUM(d)].entry) { 91 OLC_ZNUM(d) = i; 92 break; 93 } 94 } (gdb) info local arg = "old\000\000\000\000\000\334\020\270\375\376\a", '\000' <repeats 50 times>, "H\000\000\000\000\000\000\000M\027\004\375\376\a", '\000' <repeats 34 times>, "h\236\"\000\000\000\000\000\027 \001\000\376\a\000\000\370\235\"\000\000\000\000\000\030", '\000' <repeats 31 times>, "\060\345\t\200\001\000\000\000\000\001\000\000\000\000\000\000\200\237\"\000\000\000\000\000\001\000\000\000\000\000\000\000"... d = 0x6001f4ed0 i = 1 (gdb) up #1 0x0000000100480ab4 in command_interpreter (ch=0x6001fea90, argument=argument@entry=0x22a380 "hedit old") at interpreter.c:590 590 ((*complete_cmd_info[cmd].command_pointer) (ch, line, cmd, complete_cmd_info[cmd].subcmd)); (gdb) list 585 break; 586 case POS_FIGHTING: 587 send_to_char(ch, "No way! You're fighting for your life!\r\n"); 588 break; 589 } else if (no_specials || !special(ch, cmd, line)) 590 ((*complete_cmd_info[cmd].command_pointer) (ch, line, cmd, complete_cmd_info[cmd].subcmd)); 591 } 592 593 /* Routines to handle aliasing. */ 594 static struct alias_data *find_alias(struct alias_data *alias_list, char *str) (gdb) info local cmd = 513 length = <optimized out> line = 0x22a385 " old" arg = "hedit\000\000\000\343\321\020\200\v\000\000\000hedit", '\000' <repeats 11 times>, "\200\237\"\000\000\000\000\000\001", '\000' <repeats 39 times>, "\033[1z<se\000\340\210.\200\001\000\000\000\005\000\000\000\000\000\000\000`jb\000\001\000\000\000\005\000\000\000\000\000\000\000`jb\000\001\000\000\000\200\245\"\000\000\000\000\000LO\037\000\006\000\000\000\377/\000\000\000\000\000\000Md\022\200\001\000\000\000\360\237\"\000\000\000\000\000\020\240\"\000\000\000\000\000\340^\r\000\006\000\000\000ƶ\223w", '\000' <repeats 36 times>... (gdb) up #2 0x00000001004e432d in game_loop (local_mother_desc=3) at comm.c:890 890 command_interpreter(d->character, comm); /* Send it to interpreter */

This output is from Cygwin on Win7, tbaMUD 3.65
I can reproduce the same crash running on a CentOS server also.

Please Log in or Create an account to join the conversation.

More
23 Jul 2014 01:40 #4958 by Liko
Replied by Liko on topic Hedit Crash
It seems to also crash whenever I try to create a helpfile..

Randian(0.0.0)
Owner/Developer

Please Log in or Create an account to join the conversation.

More
23 Jul 2014 01:48 #4959 by Liko
Replied by Liko on topic Hedit Crash
This is what I got for my gdb output:
Code:
82 OLC_NUM(d) = 0; 83 OLC_STORAGE(d) = strdup(arg); 84 85 OLC_ZNUM(d) = search_help(OLC_STORAGE(d), LVL_IMPL); 86 87 if (help_table[OLC_ZNUM(d)].duplicate) { 88 for (i = 0; i < top_of_helpt; i++) 89 if (help_table[i].duplicate == 0 && help_table[i].entry == help_table[OLC_ZNUM(d)].entry) { 90 OLC_ZNUM(d) = i; 91 break;

Randian(0.0.0)
Owner/Developer

Please Log in or Create an account to join the conversation.

More
23 Jul 2014 01:57 #4960 by Liko
Replied by Liko on topic Hedit Crash
Line 87 is what is causing the crash.

Randian(0.0.0)
Owner/Developer

Please Log in or Create an account to join the conversation.

More
23 Jul 2014 09:13 #4962 by WhiskyTest
Replied by WhiskyTest on topic Hedit Crash
Yep that's it.
I've commented out lines 87 - 95 and I can create/save/edit old and new help files now.

The section of code that is causing the crash is dealing with duplicate entries. I'm not familiar enough with the hedit code to troubleshoot it further.

Do you think leaving that bit commented out will cause problems down the track?

Please Log in or Create an account to join the conversation.

More
23 Jul 2014 11:17 #4963 by Liko
Replied by Liko on topic Hedit Crash
See what happens when you make a duplicate help file.

Randian(0.0.0)
Owner/Developer

Please Log in or Create an account to join the conversation.

Time to create page: 0.222 seconds