30 Jan, 2007, Kayle wrote in the 1st comment:
Votes: 0
Alright, So I'm converting a friend of mine's friend's mud to a new codebase, and I had selected SWFotE as the base for this because Keb seems to know his shit, and it had a lot of nice features that I figured this person could make use of. So I started in on my converting, and found that the color code in SWFotE 2.1.5 improperly parsed color tokens in web links, resulting in screwed up links, so I fixed it by upgrading the Color snippet to the latest release of the snippet, and applied the bugfix on the SmaugFUSS forums for web addresses. The problem is now that I've converted color.c, the Nanny function in comm.c is being completely queer and crashing at certain points. So now I figure You guys need some code to be able to help me with this. So. Here goes. I'll just use the pastebin since some functions are already in it from the help Davion offered on ichat.

New Color.c

load_char_obj *Not sure of the relevance here, Davion wanted to see it too, so it might be related.

nanny( )
This is the nanny( ).

Now for a little additional information.
This is where the crash occurs:
Holonet Login: newbie

I don't recognize your name, you must be new here.

Did I get that right, Newbie (Y/N)? y

Make sure to use a password that won't be easily guessed by someone else.
Pick a good password for Newbie:


Please retype the password to confirm:


What is your sex (M/F/N)? m

You may choose from the following races, or type help [race] to learn more.
Keep in mind that you must ROLEPLAY the race you select. If you choose a
droid, you must RP your character accordingly. If you choose noghri, you
must roleplay your character as the race is expected. This applies to all
races, and if you are unsure about how to RP a race, refer to the helpfile.
If you are still unsure, do not pick that race.

[Human ] [Wookiee ] [Twi'lek ] [Rodian ]
[Hutt ] [Mon Calamari ] [Noghri ] [Gamorrean ]
[Jawa ] [Adarian ] [Ewok ] [Verpine ]
[Defel ] [Trandoshan ] [Hapan ] [Quarren ]
[Shistavanen ] [Falleen ] [Ithorian ] [Devaronian ]
[Gotal ] [Droid ] [Firrerreo ] [Barabel ]
[Bothan ] [Togorian ] [Dug ] [Kubaz ]
[Selonian ] [Gran ] [Yevetha ] [Gand ]
[Duros ] [Coynite ] [Sullustan ] [Protocol Droid ]
[Assassin Droid ] [Gladiator Droid] [Astromech Droid] [Intera Droid ]
: huma

Please choose a main ability from the following classes:
[Combat ] [Piloting ] [Engineering ] [Bounty Hunting ]
[Smuggling ] [Politician ] [Slicer ] [Assassin ]
[Technician ]
: comb

Please choose a secondary ability from the following classes:
[Piloting ] [Engineering ] [Bounty Hunting ] [Smuggling ]
[Politician ] [Slicer ] [Assassin ] [Technician ]
: pilot

Rolling stats…

STR: 16 INT: 10 WIS: 10 DEX: 15 CON: 9 CHA: 8

Are these stats OK? y

Please choose a height from the following list:
[Average ] [Short ] [Tall ] [Very tall ]
: ave

Please choose a build from the following list:
[Petite ] [Thin ] [Lean ] [Overweight ]
[Muscular ] [Obese ]
: musc


This is the gdb/bt information:
Program received signal SIGSEGV, Segmentation fault.
0x080fa4a9 in stop_idling (ch=0x86ad910) at comm.c:2983
2983 if( !ch || !ch->desc || ch->desc->connected != CON_PLAYING || !IS_IDLE( ch ) )
(gdb) bt
#0 0x080fa4a9 in stop_idling (ch=0x86ad910) at comm.c:2983
#1 0x080f31c1 in game_loop () at comm.c:596
#2 0x080f24e9 in main (argc=2, argv=0xbffffae4) at comm.c:276
#3 0x4009054d in __libc_start_main () from /lib/libc.so.6
(gdb) frame 0
#0 0x080fa4a9 in stop_idling (ch=0x86ad910) at comm.c:2983
2983 if( !ch || !ch->desc || ch->desc->connected != CON_PLAYING || !IS_IDLE( ch ) )
(gdb) frame 1
#1 0x080f31c1 in game_loop () at comm.c:596
596 stop_idling( d->character );
(gdb) frame 2
#2 0x080f24e9 in main (argc=2, argv=0xbffffae4) at comm.c:276
276 game_loop( );
(gdb) frame 3
#3 0x4009054d in __libc_start_main () from /lib/libc.so.6
(gdb) frame 0
#0 0x080fa4a9 in stop_idling (ch=0x86ad910) at comm.c:2983
2983 if( !ch || !ch->desc || ch->desc->connected != CON_PLAYING || !IS_IDLE( ch ) )
(gdb) p ch
$1 = (CHAR_DATA *) 0x86ad910
(gdb) p ch->desc
$2 = (DESCRIPTOR_DATA *) 0xa0007
(gdb) p ch->desc->connected
Cannot access memory at address 0xa0033
(gdb)


Now, maybe someone here can figure this out, because I've been fighting with it all damn day trying to decipher it, or maybe Keb will even stop by and figure it out. But I've been working on this since roughly 1:30pm EST, it's now 3:40am EST and I'm handing the towel to the next person in line, while I go and try and get some sleep before Class tonight. :sad:

EDIT: Something else occured to me and I felt the need to test it. here's teh results.

Getting through as a Droid:
.^.                                                                  .^.
| | Star Wars: Fall of the Empire | |
| | | |
| | The Rebellion, having scored | |
| | a victory against the second | |
| | deathstar, finally begin | |
| | growing in numbers. The | |
| | Empire still holds strong, but | |
| | find themselves losing battles | |
| | against the Rebellion. Hope | |
| | is beginning to grow among | |
| | members of the newly formed | |
| | New Republic. | |
| | | |
| | SWReality 1.0 by Sean (Durga the Hutt) Cooper - specs@golden.net | |
| | | |
| | +———+———+———+———+———+——–+ | |
\ / | SMAUG by Thoric with help by Altrag, Blodkai, Narn, Haus | \ /
|-| | Scryn, Rennard, Tricops & Gorog. MERC code by Hatchet, | |-|
|-| | Furey, Kahn. Diku code by Hans Staerfeldt, Katja Nyboe, | |-|
\-/ | Tom Madsen, Michael Seifert & Sebastian Hammer. | \-/
/_\ | Star Wars and Star Wars names are copyright of Lucasfilm | /_\
\ / +———+———+———+———+———+——–+ \ /
|-| | SWFotE by Tawnos, Eleven, Bambua, Danimal, and Ackbar. | |-|
|-| | SWFotE v1.1 by Trillen. | |-|
|-| | SWFotE v2.0 and v1.21 by Keberus and Trelar. | |-|
|-| | SWFotE v2.0+ by Keberus | |-|
=-= +———+———+———+———+———+——–+ =-=

Holonet Login: Newbie

I don't recognize your name, you must be new here.

Did I get that right, Newbie (Y/N)? y

Make sure to use a password that won't be easily guessed by someone else.
Pick a good password for Newbie:

Please retype the password to confirm:

What is your sex (M/F/N)? m

You may choose from the following races, or type help [race] to learn more.
Keep in mind that you must ROLEPLAY the race you select. If you choose a
droid, you must RP your character accordingly. If you choose noghri, you
must roleplay your character as the race is expected. This applies to all
races, and if you are unsure about how to RP a race, refer to the helpfile.
If you are still unsure, do not pick that race.

[Human ] [Wookiee ] [Twi'lek ] [Rodian ]
[Hutt ] [Mon Calamari ] [Noghri ] [Gamorrean ]
[Jawa ] [Adarian ] [Ewok ] [Verpine ]
[Defel ] [Trandoshan ] [Hapan ] [Quarren ]
[Shistavanen ] [Falleen ] [Ithorian ] [Devaronian ]
[Gotal ] [Droid ] [Firrerreo ] [Barabel ]
[Bothan ] [Togorian ] [Dug ] [Kubaz ]
[Selonian ] [Gran ] [Yevetha ] [Gand ]
[Duros ] [Coynite ] [Sullustan ] [Protocol Droid ]
[Assassin Droid ] [Gladiator Droid] [Astromech Droid] [Intera Droid ]
: assassin

Please choose a main ability from the following classes:
[Combat ] [Piloting ] [Engineering ] [Bounty Hunting ]
[Smuggling ] [Politician ] [Slicer ] [Assassin ]
[Technician ]
: assassin

Please choose a secondary ability from the following classes:
[Combat ] [Piloting ] [Engineering ] [Bounty Hunting ]
[Smuggling ] [Politician ] [Slicer ] [Technician ]
: bounty

Rolling stats…

STR: 15 INT: 19 WIS: -5 DEX: 12 CON: 11 CHA: 2

Are these stats OK? y

Please choose a droid description from the following list:
[Modern ] [Antique ] [Small ] [Large ]
[Tiny ] [Polished ] [Sleek ] [Huge ]
: modern

Welcome to Deadly Tactix. Press enter to continue.

modern

Message of the Day
Use 'hedit motd' to write your own message of the day.

Press [ENTER] modern


GDB:
Tue Jan 30 03:08:52 2007 :: IMC: SHA-256 Authentication completed.
Tue Jan 30 03:08:52 2007 :: IMC: Connected to Server02. Network ID: MudBytes
Tue Jan 30 03:08:56 2007 :: Sock.sinaddr: ??.??.??.??, port 2870.
Tue Jan 30 03:09:31 2007 :: Newbie@c-??-??-??-??.??.??.comcast.net new Assassin Droid.
Tue Jan 30 03:09:44 2007 :: Newbie has entered the game.
Tue Jan 30 03:09:44 2007 :: [*****] BUG: Create_object: NULL pObjIndex.

Program exited with code 01.
(gdb)
30 Jan, 2007, Davion wrote in the 2nd comment:
Votes: 0
I've been looking over this for a bit trying to take it all in. I'm convinced you're getting some memory trampling somewhere. I'm basing this mostly on->
# Message of the Day
# Use 'hedit motd' to write your own message of the day.
#
# Press [ENTER] modern


The 'modern' there is your build, and corrisponds to &w in the nanny function. I think it's reset_colors. There's a few things about this function that just scream unsafe. My main beef with this is

if( !str_cmp( word, "MaxColors" ) )
{
max_colors = fread_number( fp );
continue;
}
if( !str_cmp( word, "Colors" ) )
{
for( x = 0; x < max_colors; ++x )
ch->colors[x] = fread_number( fp );
continue;
}


You have to make sure that max_colors isn't larger than the array sized for colors. Because if max_colors > sizeof ch->colors, you'll get that memory trampling and your descriptors will go bye bye.

Another reason for this is because if you're a droid reset_colors() is -never- called on you. The reason you fail with a droid is another reason. It's because of Create_object. It also doesn't crash, it's closed via exit(1); To remedy this part, make sure you look at the many calls to create_obj (It starts at line 964 in the pastebin for nanny())

I of course could be way off. Another suggestion, run under valgrind with –leak-check=full, pound at it and post output here.
30 Jan, 2007, Guest wrote in the 3rd comment:
Votes: 0
The color overflow could certainly be a problem, it was fixed here: http://www.smaugmuds.org/index.php?a=top... but I don't know if Keberus uses the exact same color code as the FOTE FUSS version. But they all derive from the color code snippet for Smaug that I've uploaded here.

Quote
0 0x080fa4a9 in stop_idling (ch=0x86ad910) at comm.c:2983
2983 if( !ch || !ch->desc || ch->desc->connected != CON_PLAYING || !IS_IDLE( ch ) )
(gdb) p ch
$1 = (CHAR_DATA *) 0x86ad910
(gdb) p ch->desc
$2 = (DESCRIPTOR_DATA *) 0xa0007
(gdb) p ch->desc->connected
Cannot access memory at address 0xa0033
(gdb)


Davion may well be right since the descriptor has obviously been smashed.
30 Jan, 2007, Kayle wrote in the 4th comment:
Votes: 0
I'll attempt what Davion said, but as I've said on ichat many many times, I don't know how to use valgrind, but I'd really like to learn, so if someone wants to post an article about it that'd be great :tongue:

Keberus doesn't use the same color code, but I swapped it out for the same color code. which is when all this began. and now that Davion pointed out the reset_colors thing, it's all starting to make a little more sense.
30 Jan, 2007, Kayle wrote in the 5th comment:
Votes: 0
Ok, I added in the color fix, and that handled everything. Now I just have to figure out why create_object is dying.
30 Jan, 2007, Kayle wrote in the 6th comment:
Votes: 0
Well, that was easy enough to fix, I deleted all the areas, and uploaded fresh copies and viola, create object problem vanished. Now it works perfectly. I just have to fix the horrid color output now. XD
31 Jan, 2007, Conner wrote in the 7th comment:
Votes: 0
Gratz! :smile:
0.0/7