W3C home > Mailing lists > Public > html-tidy@w3.org > April to June 1999

Empty inline stack referenced

From: Andy Quick <ac.quick@sympatico.ca>
Date: Sun, 13 Jun 1999 18:31:56 -0400
Message-ID: <001301beb5ec$8f93f3e0$5e42acce@quick>
To: <html-tidy@w3.org>
Dave,

I found this problem when I got an array index exception in the Java version.  The attached test case shows the problem.  You will see that it has out of order </font> and </li> tags.  If you put the debug message in the function InsertedToken as shown below, you will see the message printed out when tidy is given the test case as input.  It seems to indicate that istack references an element that has been popped from the inline stack.

Andy Quick

------------------------------------------
Node *InsertedToken(Lexer *lexer)
{
    Node *node;
    IStack *istack;
    uint n;

    /* this will only be null if inode != null */
    if (lexer->insert == null)
    {
        node = lexer->inode;
        lexer->inode = null;
        return node;
    }

    /*
    
      is this is the "latest" node then update
      the position, otherwise use current values
    */

    if (lexer->inode == null)
    {
        lexer->lines = lexer->in->curline;
        lexer->columns = lexer->in->curcol;
    }

    node = NewNode();
    node->type = StartTag;
    node->implicit = yes;
    node->start = lexer->txtstart;
    node->end = lexer->txtstart;
    istack = lexer->insert;
    /* AQ: the following debug message shows that istack references an empty stack */
    if (lexer->istacksize == 0)
        tidy_out(lexer->errout, "0-size istack!\n");
    node->element = wstrdup(istack->element);
    node->tag = istack->tag;
    node->attributes = DupAttrs(istack->attributes);

    /* advance lexer to next item on the stack */
    n = lexer->insert - &(lexer->istack[0]);

    /* and recover state if we have reached the end */
    if (++n < lexer->istacksize)
        lexer->insert = &(lexer->istack[n]);
    else
        lexer->insert = null;

    return node;
}




Received on Sunday, 13 June 1999 18:33:02 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:42 GMT