Fossil SCM

In html_header(), stop building the heading id when an unclosed tag or entity reaches the end of the text. The scan stepped over the terminator and continued past the end of the text.

dmestas 2026-11-13 23:39 UTC small-fixes-2
Commit acb3fd723e0c70936ad1b483fe96c36576f0742504982c59e67918550ed2e011
1 file changed +2
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -250,12 +250,14 @@
250250
z[j++] = fossil_tolower(z[i]);
251251
}else if( fossil_isspace(z[i]) || z[i]=='-' || z[i]=='_' ){
252252
if( j>0 && z[j-1]!='-' ) z[j++] = '-';
253253
}else if( z[i]=='<' ){
254254
do{ i++; }while( z[i]!=0 && z[i]!='>' );
255
+ if( z[i]==0 ) break;
255256
}else if( z[i]=='&' ){
256257
do{ i++; }while( z[i]!=0 && z[i]!=';' );
258
+ if( z[i]==0 ) break;
257259
}else if( (z[i]&0x80)!=0 ){
258260
z[j++] = z[i];
259261
}
260262
}
261263
if( j>0 && z[j-1]=='-' ) j--;
262264
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -250,12 +250,14 @@
250 z[j++] = fossil_tolower(z[i]);
251 }else if( fossil_isspace(z[i]) || z[i]=='-' || z[i]=='_' ){
252 if( j>0 && z[j-1]!='-' ) z[j++] = '-';
253 }else if( z[i]=='<' ){
254 do{ i++; }while( z[i]!=0 && z[i]!='>' );
 
255 }else if( z[i]=='&' ){
256 do{ i++; }while( z[i]!=0 && z[i]!=';' );
 
257 }else if( (z[i]&0x80)!=0 ){
258 z[j++] = z[i];
259 }
260 }
261 if( j>0 && z[j-1]=='-' ) j--;
262
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -250,12 +250,14 @@
250 z[j++] = fossil_tolower(z[i]);
251 }else if( fossil_isspace(z[i]) || z[i]=='-' || z[i]=='_' ){
252 if( j>0 && z[j-1]!='-' ) z[j++] = '-';
253 }else if( z[i]=='<' ){
254 do{ i++; }while( z[i]!=0 && z[i]!='>' );
255 if( z[i]==0 ) break;
256 }else if( z[i]=='&' ){
257 do{ i++; }while( z[i]!=0 && z[i]!=';' );
258 if( z[i]==0 ) break;
259 }else if( (z[i]&0x80)!=0 ){
260 z[j++] = z[i];
261 }
262 }
263 if( j>0 && z[j-1]=='-' ) j--;
264

Keyboard Shortcuts

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