Thread overview
Fix for endless loop with HTML files
Nov 14, 2004
David Friedman
Nov 14, 2004
Thomas Kuehne
November 09, 2004
The problem is when it encounters a '<'
character, that is *not* followed by a
valid tag start, according to istagstart()

Such as: < CODE >, and similar constructs.

Then it fails to advance the pointer (!),
and keeps on scanning the '<' character
forever. Inserting a "else p++;" works...

You still need <code> and </code> in order
for D to actually parse the code, but at
least it comes back again with this patch.

--anders




November 14, 2004
Anders F Björklund wrote:
> The problem is when it encounters a '<'
> character, that is *not* followed by a
> valid tag start, according to istagstart()
> 
> Such as: < CODE >, and similar constructs.
> 
> Then it fails to advance the pointer (!),
> and keeps on scanning the '<' character
> forever. Inserting a "else p++;" works...
> 
> You still need <code> and </code> in order
> for D to actually parse the code, but at
> least it comes back again with this patch.
> 
> --anders
> 

Thanks!  I don't think "< CODE >" is valid HTML, so this patch should be enough.

David
November 14, 2004
David Friedman schrieb:
> > You still need <code> and </code> in order
> > for D to actually parse the code, but at
> > least it comes back again with this patch.
>
> Thanks!  I don't think "< CODE >" is valid HTML, so this patch should be enough.


I've run the attached file (with "< code>" and "</ code>")through the validator at http://validator.w3.org/check

An got no warnings or errors.

Thomas



November 14, 2004
Thomas Kuehne wrote:

> I've run the attached file (with "< code>" and "</ code>")through the
> validator at http://validator.w3.org/check
> 
> An got no warnings or errors.

If you validate as XHTML, instead of the old HTML 4.0,
you get the following validation errors (from same w3):

1.
> Line 9, column 2: character "<" is the first character of a delimiter
> but occurred as data
> 
> < code >
> 
> If you wish to include the "<" character in your output, you should
> escape it as "&lt;". Another possibility is that you forgot to close
> quotes in a previous tag.

2.
> Line 9, column 2: character data is not allowed here
> 
> < code >
> 
> You have used character data somewhere it is not permitted to appear.
> 
> Mistakes that can cause this error include putting text directly in the
> body of the document without wrapping it in a container element (such as
> a <p>aragraph</p>) or forgetting to quote an attribute value (where
> characters such as "%" and "/" are common, but cannot appear without
> surrounding quotes).

In general, XHTML and UTF-8 are now recommended
instead of the old HTML 4.01 and ISO-8859-1...


Anyway, nobody writes < code > in any real stuff.
It's just that it's nice if D doesn't HANG on it. :-)

--anders