Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
 parse description bug
Yesterday, 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
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
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
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Yahoo!

Members: 0
Guests: 8
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,240
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » strange crash in color.c
Forum Rules | Mark all | Recent Posts

strange crash in color.c
< Newer Topic :: Older Topic > I didn't touch anything, I swear!

Pages:<< prev 1 next >>
* #1 Jan 8, 2011, 10:53 pm   Last edited Jan 8, 2011, 10:53 pm by Aurin
Go to the top of the page
Go to the bottom of the page

Aurin
Magician
GroupMembers
Posts189
JoinedSep 5, 2010

okay, I'm at a complete loss as to why this is crashing. there's no reason that I can see for it to crash, any help debugging this and getting it fixed would be appreciated, as I'm a noob^11 coder, as previously stated. heh

so, game did a random crash and not really sure why. was just myself, another imm with an alt grinding, and a player (Dace) grouped with imm's alt grinding. no one was mounted, so no reason to see what is shown below, as far as I can tell. also, no mobs in the game are mounted.

#0  colorcode (src=0x82c0bd0 "he ground...\r\nOUCH!\r\n",
    dst=0xbfffecb8 "Øìÿ¿\221©\016\b\204<;@`i1\b", d=0x95ae068, dstlen=20,
    vislen=0x0) at color.c:875
875           ansi = (!IS_NPC(ch) && xIS_SET(ch->act, PLR_ANSI));
(gdb) bt
#0  colorcode (src=0x82c0bd0 "he ground...\r\nOUCH!\r\n",
    dst=0xbfffecb8 "Øìÿ¿\221©\016\b\204<;@`i1\b", d=0x95ae068, dstlen=20,
    vislen=0x0) at color.c:875
#1  0x080ea8dc in colorize (
    txt=0x82c0ba8 "No longer upon your mount, you fall to the ground...\r\nOUCH!\r\n", d=0x95ae068) at color.c:1451
#2  0x080ea985 in send_to_desc_color (
    txt=0x82c0ba8 "No longer upon your mount, you fall to the ground...\r\nOUCH!\r\n", d=0x95ae068) at color.c:1574
#3  0x080ea9d5 in send_to_char (
    txt=0x82c0ba8 "No longer upon your mount, you fall to the ground...\r\nOUCH!\r\n", ch=0x403b3c2c) at color.c:1590
#4  0x08212ee6 in char_check () at update.c:2943
#5  0x0821940c in update_handler () at update.c:3510
#6  0x080f17de in game_loop () at comm.c:1350
#7  0x080f5261 in main (argc=1730176360, argv=0x6e756f72) at comm.c:859


function at color.c 875
int colorcode(const char *src, char *dst, DESCRIPTOR_DATA *d, int dstlen, int *vislen)
{
  CHAR_DATA              *ch = NULL;
  bool                    ansi = FALSE;
  char                   *sympos = NULL;

  /*
   * No descriptor, assume ANSI conversion can't be done. 
   */
  if(!d)
    ansi = FALSE;
  /*
   * But, if we have one, check for a PC and set accordingly. If no PC, assume ANSI can be done. For color logins. 
   */
  else
  {
    ch = d->original ? d->original : d->character;

    if(ch)
// This is line 875
      ansi = (!IS_NPC(ch) && xIS_SET(ch->act, PLR_ANSI));
// ^^^^^^^^^^^^^^^^^^^^^^^
    else
      ansi = TRUE;
  }
...


and one step back
char                   *colorize(const char *txt, DESCRIPTOR_DATA *d)
{
  static char             result[MAX_STRING_LENGTH * 10];

  *result = '\0';

  if(txt && *txt && d)
  {
    char                   *colstr;
    const char             *prevstr = txt;
    char                    colbuf[20];
    int                     ln;

    while((colstr = strpbrk(prevstr, "&^}hH")) != NULL)
    {
      register int            reslen = 0;

      if(colstr > prevstr)
      {
        if((MAX_STRING_LENGTH * 10 - (reslen = strlen(result))) <= (colstr - prevstr))
        {
          bug("%s: OVERFLOW in internal MAX_STRING_LENGTH buffer!", __PRETTY_FUNCTION__);
          break;
        }
        strncat(result, prevstr, (colstr - prevstr)); /* Leave this one alone! BAD
                                                       * THINGS(TM) will happen if you
                                                       * don't! */
        result[reslen + (colstr - prevstr)] = '\0'; /* strncat will NOT NULL terminate
                                                     * this! */
      }

      if(colstr[0] == 'h' || colstr[0] == 'H')
        if(colstr[1] == 't' || colstr[1] == 'T')
          if(colstr[2] == 't' || colstr[2] == 'T')
            if(colstr[3] == 'p' || colstr[3] == 'P')
            {
              char                    http[MAX_INPUT_LENGTH];

              one_http_argument(colstr, http);
              mudstrlcat(result, http, sizeof(result));
              ln = strlen(http);
              prevstr = colstr + ln;
              continue;
            }
// This is line 1451
      ln = colorcode(colstr, colbuf, d, 20, NULL);
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      if(ln > 0)
      {
        mudstrlcat(result, colbuf, MAX_STRING_LENGTH * 10);
        prevstr = colstr + ln;
      }
      else
        prevstr = colstr + 1;
    }
    if(*prevstr)
      mudstrlcat(result, prevstr, MAX_STRING_LENGTH * 10);
  }
  return result;
}
       
Post is unread #2 Jan 9, 2011, 1:51 am
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

Looks like junk data got passed in as colbuf. And something, somewhere has to be mounted or something happened and the chec for that message got screwed up somehow.
       
Post is unread #3 Jan 9, 2011, 11:04 am
Go to the top of the page
Go to the bottom of the page

Aurin
Magician
GroupMembers
Posts189
JoinedSep 5, 2010

While I can appreciate a random crash for being random, any way to just implement a check so it doesn't happen again? I dislike crashing for no particular reason, then having to just deal with it as the norm as there's no real way to fix it. :(
       
Post is unread #4 Jan 9, 2011, 5:16 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

Well I had looked at it earlier today (although it said the exe was newer then the core which again makes it kind of unreliable). It still showed everything that you posted here and when I checked everything it showed more or less that ch was there but all data in it was invalid. Can't really check it when it is there but not valid. Will have to hope that eventually it gives you a little more info to go on so you can fix the problem.
       
Post is unread #5 Jan 9, 2011, 9:02 pm   Last edited Jan 9, 2011, 9:05 pm by Aurin
Go to the top of the page
Go to the bottom of the page

Aurin
Magician
GroupMembers
Posts189
JoinedSep 5, 2010

okay, I'll leave this open in for when/if it happens again. I very much dislike seeing bugs pop up to cause a crash, even if it IS a random, nearly-one-time occurrence. heh

oooo..I wonder, could this possibly be related to a previous memleak that I reported? if so, that may explain the garbage data.
       
Pages:<< prev 1 next >>