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.

dmestas 2026-11-13 23:39 UTC small-fixes-2
Commit bfc75655a3fdb0c1f3ed715da5b68084eb0d0448fb9fc44b239f64941f90363f
1 file changed +10 -9
+10 -9
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -959,25 +959,26 @@
959959
i++;
960960
zValue = &z[i];
961961
while( z[i] && z[i]!='\'' ){ i++; }
962962
}else{
963963
zValue = &z[i];
964
- while( !fossil_isspace(z[i]) && z[i]!='>' ){
964
+ while( z[i] && !fossil_isspace(z[i]) && z[i]!='>' ){
965965
if( z[i]=='\'' || z[i]=='"' ) attrOk = 0;
966966
i++;
967967
}
968968
}
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];
969974
if( attrOk ){
970975
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++;
979980
}
980981
if( attrOk ){
981982
if( aAttribute[iACode].iMask ) seen |= aAttribute[iACode].iMask;
982983
p->nAttr++;
983984
}
984985
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button