Fossil SCM
In parseMarkup(), note the character that ends an attribute value even for an attribute that is ignored, and stop the scan at the end of the string. A tag with an unrecognised unquoted attribute ran past the markup and into the text that followed.
Commit
bfc75655a3fdb0c1f3ed715da5b68084eb0d0448fb9fc44b239f64941f90363f
Parent
aca46352a89147d…
1 file changed
+10
-9
+10
-9
| --- src/wikiformat.c | ||
| +++ src/wikiformat.c | ||
| @@ -959,25 +959,26 @@ | ||
| 959 | 959 | i++; |
| 960 | 960 | zValue = &z[i]; |
| 961 | 961 | while( z[i] && z[i]!='\'' ){ i++; } |
| 962 | 962 | }else{ |
| 963 | 963 | zValue = &z[i]; |
| 964 | - while( !fossil_isspace(z[i]) && z[i]!='>' ){ | |
| 964 | + while( z[i] && !fossil_isspace(z[i]) && z[i]!='>' ){ | |
| 965 | 965 | if( z[i]=='\'' || z[i]=='"' ) attrOk = 0; |
| 966 | 966 | i++; |
| 967 | 967 | } |
| 968 | 968 | } |
| 969 | + /* c is the character that ended the value. It has to be noted | |
| 970 | + ** even for an attribute that is ignored, or the ">" that ends the | |
| 971 | + ** markup is stepped over and the text after it is parsed as more | |
| 972 | + ** attributes. */ | |
| 973 | + c = z[i]; | |
| 969 | 974 | if( attrOk ){ |
| 970 | 975 | p->aAttr[p->nAttr].zValue = zValue; |
| 971 | - p->aAttr[p->nAttr].cTerm = c = z[i]; | |
| 972 | - if( z[i]==0 ){ | |
| 973 | - i--; | |
| 974 | - }else{ | |
| 975 | - z[i] = 0; | |
| 976 | - } | |
| 977 | - } | |
| 978 | - i++; | |
| 976 | + p->aAttr[p->nAttr].cTerm = c; | |
| 977 | + if( c ) z[i] = 0; | |
| 978 | + } | |
| 979 | + if( c ) i++; | |
| 979 | 980 | } |
| 980 | 981 | if( attrOk ){ |
| 981 | 982 | if( aAttribute[iACode].iMask ) seen |= aAttribute[iACode].iMask; |
| 982 | 983 | p->nAttr++; |
| 983 | 984 | } |
| 984 | 985 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -959,25 +959,26 @@ | |
| 959 | i++; |
| 960 | zValue = &z[i]; |
| 961 | while( z[i] && z[i]!='\'' ){ i++; } |
| 962 | }else{ |
| 963 | zValue = &z[i]; |
| 964 | while( !fossil_isspace(z[i]) && z[i]!='>' ){ |
| 965 | if( z[i]=='\'' || z[i]=='"' ) attrOk = 0; |
| 966 | i++; |
| 967 | } |
| 968 | } |
| 969 | if( attrOk ){ |
| 970 | p->aAttr[p->nAttr].zValue = zValue; |
| 971 | p->aAttr[p->nAttr].cTerm = c = z[i]; |
| 972 | if( z[i]==0 ){ |
| 973 | i--; |
| 974 | }else{ |
| 975 | z[i] = 0; |
| 976 | } |
| 977 | } |
| 978 | i++; |
| 979 | } |
| 980 | if( attrOk ){ |
| 981 | if( aAttribute[iACode].iMask ) seen |= aAttribute[iACode].iMask; |
| 982 | p->nAttr++; |
| 983 | } |
| 984 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -959,25 +959,26 @@ | |
| 959 | i++; |
| 960 | zValue = &z[i]; |
| 961 | while( z[i] && z[i]!='\'' ){ i++; } |
| 962 | }else{ |
| 963 | zValue = &z[i]; |
| 964 | while( z[i] && !fossil_isspace(z[i]) && z[i]!='>' ){ |
| 965 | if( z[i]=='\'' || z[i]=='"' ) attrOk = 0; |
| 966 | i++; |
| 967 | } |
| 968 | } |
| 969 | /* c is the character that ended the value. It has to be noted |
| 970 | ** even for an attribute that is ignored, or the ">" that ends the |
| 971 | ** markup is stepped over and the text after it is parsed as more |
| 972 | ** attributes. */ |
| 973 | c = z[i]; |
| 974 | if( attrOk ){ |
| 975 | p->aAttr[p->nAttr].zValue = zValue; |
| 976 | p->aAttr[p->nAttr].cTerm = c; |
| 977 | if( c ) z[i] = 0; |
| 978 | } |
| 979 | if( c ) i++; |
| 980 | } |
| 981 | if( attrOk ){ |
| 982 | if( aAttribute[iACode].iMask ) seen |= aAttribute[iACode].iMask; |
| 983 | p->nAttr++; |
| 984 | } |
| 985 |