Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Naver

Members: 0
Guests: 9
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
612
Jacki72H
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » AFKMud Support & Development » Seg fault afkmud 1.64
Forum Rules | Mark all | Recent Posts

Seg fault afkmud 1.64
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Feb 26, 2005, 9:33 pm
Go to the top of the page
Go to the bottom of the page

Celestria

GroupMembers
Posts28
JoinedFeb 24, 2005

Help!
I've recently installed afkmud 1.64, I'm getting a seg fault when you stat an object that has a use program. Totally boots us off the mud. Running cygwin and winxp.
Segmentation fault is what i get and that's all.
Stating normal objects is fine. Any idea why this might be and how i can fix it?
I have a degree in programming but haven't coded anything in 6 years. It's starting to come back to me a bit. It was all database programming and for windows though so....
Still relearning the ropes.
       
Post is unread #2 Feb 27, 2005, 3:20 am
Go to the top of the page
Go to the bottom of the page

shaun

GroupMembers
Posts2
JoinedFeb 24, 2005

there should be some kind of core dump that you can read and see if you can figure out where the problem is coming from. Also, you could try running it in gdb and try to duplicate the bug (though it doesn't sound like you'll have much trouble with that one).
       
Post is unread #3 Feb 27, 2005, 7:39 am   Last edited Nov 24, 2007, 2:01 pm by Samson
Go to the top of the page
Go to the bottom of the page

Celestria

GroupMembers
Posts28
JoinedFeb 24, 2005

I tried finding the core dump file but couldn't. I scoured forums yesterday looking for answers. Didn't find any but I got some of my own, not sure how to fix it though.
When you put an int larger than 18 in v3 of an armor object or larger than 13 in v4, it doesnt' give any errors, yet if you try to stat that object after you have done so, it hangs up and I get a seg fault core dump. There is error checking for it in treasure.c but not in build.c in function do_ostat. I don't really want to mess with the code too much until I get used to what all the functions are etc... I can tell it's putting value's into the structure etc.. but i just don't want to break it more by messing with it.
here is the section of code I believe is causing the bug I may very well be wrong.
In treasure.c it says value3 has to be lower than 18 and value4 has to be lower than 13 otherwise you get an error msg for type armor.
When you create an item and set those values it's ok, you don't get an error, but if you put in a value over those and stat it, that is when it's seg faults and everybody gets booted from the mud.

build.c do_ostat

   if( !str_cmp( arg2, "value3" ) || !str_cmp( arg2, "v3" ) )
    {
	obj->value[3] = value;

	if( IS_OBJ_FLAG( obj, ITEM_PROTOTYPE ) )
	  obj->pIndexData->value[3] = value;

	/* Automatic armor stat generation, v3 and v4 must both be non-zero */
	if( obj->item_type == ITEM_ARMOR && obj->value[3] > 0 && obj->value[4] > 0 )
	   armorgen( obj );

	send_to_char( "Object value set.\r\n", ch );
	return;
    }

   if( !str_cmp( arg2, "value4" ) || !str_cmp( arg2, "v4" ) )
    {
	obj->value[4] = value;

	if( IS_OBJ_FLAG( obj, ITEM_PROTOTYPE ) )
	  obj->pIndexData->value[4] = value;

	/* Automatic armor stat generation, v3 and v4 must both be non-zero */
	if( obj->item_type == ITEM_ARMOR && obj->value[3] > 0 && obj->value[4] > 0 )
	   armorgen( obj );

	send_to_char( "Object value set.\r\n", ch );
	return;
    }
       
Post is unread #4 Feb 27, 2005, 7:45 am
Go to the top of the page
Go to the bottom of the page

Celestria

GroupMembers
Posts28
JoinedFeb 24, 2005

Err, under do_oset not o_stat
       
Post is unread #5 Feb 27, 2005, 10:06 am
Go to the top of the page
Go to the bottom of the page

Celestria

GroupMembers
Posts28
JoinedFeb 24, 2005

NM I fixed it myself, put in error checking in oset if the value is greater than 17 or 13 respectively for their values.
No more core dumps
       
Post is unread #6 Feb 27, 2005, 11:59 am
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Ah, the infamous array bounds violation

Anyway, nice catch. I've posted a complete fix for this problem on the bugfix list - you'll have the same issue to contend with on weapons as well.
       
Post is unread #7 Feb 27, 2005, 12:10 pm
Go to the top of the page
Go to the bottom of the page

Celestria

GroupMembers
Posts28
JoinedFeb 24, 2005

hehe yeah I caught that, I'll check over your fix to make sure I haven't missed something and thank you!
       
Pages:<< prev 1 next >>