Stock BUG!

From: George (greerga@DRAGON.HAM.MUOHIO.EDU)
Date: 09/10/97


Here's a subtle bug for people.

Upon booting in mini-mud mode on Solaris, I suspected a memory overrun and
traced it to the assign_kings_castle() function of castle.c.  In the
function, there are assignments such as:

  C_MOB_SPEC(Z_KINGS_C, 0) = CastleGuard;   /* Gwydion */

This looks innocent enough until you look at the definition of C_MOB_SPEC:

#define C_MOB_SPEC(zone,mob) (mob_index[real_mobile(((zone)*100)+(mob))].func)

Notice there is *no error checking* if the mob doesn't exist.  So you you
do not have this mob, as is the case for mini-mud mode, you will be
assigning a special procedure to mob_index[-1].func for every one that is
missing.

My temporary workaround for this problem was to change the definition to:

#define C_MOB_SPEC(zone,mob)    \
        if ((check = real_mobile(((zone)*100)+(mob))) < 0) {\
          log("Ack! A -1");     \
        } else \
          mob_index[check].func

and to add an 'int check;' to the top of assign_kings_castle();

This is the output in mini-mud mode:

[snip]
Wed Sep 10 12:47:57 :: Assigning function pointers:
Wed Sep 10 12:47:57 ::    Mobiles.
Wed Sep 10 12:47:57 :: Ack! A -1
Wed Sep 10 12:47:57 :: Ack! A -1
Wed Sep 10 12:47:57 :: Ack! A -1
[snip]

I am not totally sure if this is what was causing OasisOLC to crash...I'll
investigate some more.

(Note that this bug will not affect normal (non -m) MUD mode.)

--
George Greer  -  Me@Null.net   | Genius may have its limitations, but stupidity
http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST