Fossil

View Ticket
Login
2010-09-26
11:11 Fixed ticket [675aaa3458]: fossil says valid html element is invalid plus 1 other change artifact: 34e7fcfac1 user: drh
11:11
Increased robustness of the XML markup parser. Ticket [675aaa3458199c8832c6879b43325ffb2fd62e75] check-in: ee78a38128 user: drh tags: trunk
2010-09-24
21:51 Ticket [675aaa3458] fossil says valid html element is invalid status still Open with 2 other changes artifact: 97656465e9 user: renez
2010-09-22
07:50 New ticket [675aaa3458]. artifact: 4a23a0cd4f user: renez

Ticket Hash: 675aaa3458199c8832c6879b43325ffb2fd62e75
Title: fossil says valid html element is invalid
Status: Fixed Type: Code_Defect
Severity: Important Priority:
Subsystem: Resolution: Fixed
Last Modified: 2010-09-26 11:11:35
15.95 years ago
Created: 2010-09-22 07:50:35
15.96 years ago
Version Found In: 3243e63bba
Description:
<hr/> is a valid xhtml element. Fossil says it is not. However <hr /> and <hr id='hrid'/> are considered valid.

The problem is in wikiformat.c:markupLength in the line

while( isalnum(z[n]) ){ n++; }

==> if( (c = z[n])!='>' && !isspace(c) ) return 0;

while( (c = z[n])!=0 && (c!='>' || inparen) ){

renez added on 2010-09-24 21:51:04:
looking further at the routine it will invalidate this to

  • <img src="img.png" alt="d'art noir" title="/> black art" />
  • < hr />

This will do a bit better but will still not catch all

like <hr//> will be valid

static int markupLength(const char *z){
  int n = 1;
  int quote;
  int c;
  if( z[n]=='/' ){ n++; }
  while(isspace(z[n])) n++;
  if( !isalpha(z[n]) ) return 0;
  n++;
  while(isalnum(z[n])) n++;
  while( (c = z[n]) && c!='>'){
    if( c=='"' || c=='\'' ){
      n++;
      for(quote=c; (c=z[n]) && c!=quote; n++) ; //look for the same closing quote
      if(!c) return 0;
    }
    n++;
  }
  return c ? n+1 : c ;
}