Re: Crashing on Show Shop [long]

From: Ryan Guthrie--Sim (circle@DKMUD.DK)
Date: 06/12/98


I often get crashes where you are crashing when i am trying to access a
array like:
int test[10];
...
sprintf(buf, "%d", test[11]);

Although only happens when it is in a spec...

On Fri, 12 Jun 1998, Ghost Shaidan wrote:

> Hi,
>
> We have been converting zones from other code bases to add in some all
> time favorites, and our most recent conversion has about 15 shops in it.
> Bringing our total to 112 shops.
>
> The shops are in 2 files, one has 14 shop entries, one has 1.
>
> The file with 1 works fine.  The file with 14 works fine through the first
> 12.  If I take some out, the last 2 shops work, and it boots up fine even
> with all 14 in the file.
>
> If all 14 are in the file however, shop shop crashes us on the last page
> of the output (6/6).
>
> I can put in up to 110 shops.  I am thinking we are over running buf in
> list_detailed_shop perhaps.  (We have had similar problems when listing
> rent files, usually because of the extra chars from our color codes.)
>
> I declared a second var (  char buf2[32768];)  and replace all instances
> of buf with buf2 in the list_detailed_shop() function.  We still crash.
>
> There is also a buf1 that is used, but it doesnt look to hold enough for
> us to over run it.
>
> The strangest part is the gdb output:
>
> 0  0x80a778a in special (ch=0x8c93bf0, cmd=4, arg=0x8102bef "")
>     at interpreter.c:1534
> 1534        if (GET_MOB_SPEC(k) != NULL)
> (gdb) bt
> #0  0x80a778a in special (ch=0x8c93bf0, cmd=4, arg=0x8102bef "")
>     at interpreter.c:1534
> #1  0x8062b66 in do_simple_move (ch=0x8c93bf0, dir=3,
> need_specials_check=1)
>     at act.movement.c:171
> #2  0x806373d in perform_move (ch=0x8c93bf0, dir=3, need_specials_check=1)
>     at act.movement.c:326
> #3  0x80b21f8 in mobile_activity () at mobact.c:99
> #4  0x804abd6 in heartbeat (pulse=100) at comm.c:727
> #5  0x804ab59 in game_loop (mother_desc=3) at comm.c:701
> #6  0x8049a27 in init_game (port=5000) at comm.c:275
> #7  0x804999c in main (argc=2, argv=0xbffffd98) at comm.c:246
> #8  0x804955b in ___crt_dummy__ ()
> (gdb) list
> 1529          if (GET_OBJ_SPEC(i) (ch, i, cmd, arg))
> 1530            return 1;
> 1531
> 1532      /* special in mobile present? */
> 1533      for (k = world[ch->in_room].people; k; k = k->next_in_room)
> 1534        if (GET_MOB_SPEC(k) != NULL)
> 1535          if (GET_MOB_SPEC(k) (ch, k, cmd, arg))
> 1536            return 1;
> 1537
> 1538      /* special in object present? */
>
>
> Alot of our core files indicate crashes at this spot.  I think when we
> over run memory we are over running either a mob or plr or obj index
> (sometimes it crashes a few lines further up).
>
> The shop code kind of intimidates me, I have made 2 modifications to it:
> We list the objects the shop sells differently (in color and a different
> order to make up for some spacing issues due to the color codes).
>
> And I flag everything purchased at a store !SACRIFCE so that people can't
> get cheap heals by sacing daggers or papers....
>
> If anyone has any ideas or has run across this before, I would appriciate
> anything that would help me through this.
>
> Ghost Shaidan
> qs.mudservices.com 4000
>
>
>      +------------------------------------------------------------+
>      | Ensure that you have read the CircleMUD Mailing List FAQ:  |
>      | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
>      +------------------------------------------------------------+
>


     +------------------------------------------------------------+
     | 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/15/00 PST