Fossil SCM

Remove redundant <code>assert()</code> that fails for the case when the content of a span-bounded inline footnote is rendered into a void. This is a corner case that was revealed via fuzzing.

george 2022-04-22 12:49 markdown-footnotes
Commit cab8a586ae5062c81514744db742d191f7caa554120c7876ead00c293d687ea3
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -483,11 +483,11 @@
483483
#define _joined_footnote_indicator "<ul class='fn-joined'>"
484484
#define _jfi_sz (sizeof(_joined_footnote_indicator)-1)
485485
/* make.footnote_item() invocations should pass args accordingly */
486486
const struct Blob *upc = text+1;
487487
assert( text );
488
- assert( blob_size(text) );
488
+ /* allow blob_size(text)==0 for constructs like [...](^ [] ()) */
489489
memset(pos,0,24);
490490
sprintf(pos, "%s-%d", unique, iMark);
491491
blob_appendf(ob, "<li id='footnote%s' class='", pos);
492492
if( nUsed ){
493493
if( blob_size(text)>=_jfi_sz &&
494494
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -483,11 +483,11 @@
483 #define _joined_footnote_indicator "<ul class='fn-joined'>"
484 #define _jfi_sz (sizeof(_joined_footnote_indicator)-1)
485 /* make.footnote_item() invocations should pass args accordingly */
486 const struct Blob *upc = text+1;
487 assert( text );
488 assert( blob_size(text) );
489 memset(pos,0,24);
490 sprintf(pos, "%s-%d", unique, iMark);
491 blob_appendf(ob, "<li id='footnote%s' class='", pos);
492 if( nUsed ){
493 if( blob_size(text)>=_jfi_sz &&
494
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -483,11 +483,11 @@
483 #define _joined_footnote_indicator "<ul class='fn-joined'>"
484 #define _jfi_sz (sizeof(_joined_footnote_indicator)-1)
485 /* make.footnote_item() invocations should pass args accordingly */
486 const struct Blob *upc = text+1;
487 assert( text );
488 /* allow blob_size(text)==0 for constructs like [...](^ [] ()) */
489 memset(pos,0,24);
490 sprintf(pos, "%s-%d", unique, iMark);
491 blob_appendf(ob, "<li id='footnote%s' class='", pos);
492 if( nUsed ){
493 if( blob_size(text)>=_jfi_sz &&
494
--- test/markdown-test3.md
+++ test/markdown-test3.md
@@ -43,10 +43,12 @@
4343
Default skin renders label in red font and the main text in gray.
4444
Other styling may also apply.
4545
4646
Inline footnotes are supported.(^These may be usefull for adding
4747
<s>small</s> comments.)
48
+
49
+This is a corner case that is rendered as [an empty footnote](^ [] ()).
4850
4951
If [undefined label is used][^] then red "`misref`" is emited instead of
5052
a numeric marker.[^ see it yourself ]
5153
This can be overridden by the skin though.
5254
5355
--- test/markdown-test3.md
+++ test/markdown-test3.md
@@ -43,10 +43,12 @@
43 Default skin renders label in red font and the main text in gray.
44 Other styling may also apply.
45
46 Inline footnotes are supported.(^These may be usefull for adding
47 <s>small</s> comments.)
 
 
48
49 If [undefined label is used][^] then red "`misref`" is emited instead of
50 a numeric marker.[^ see it yourself ]
51 This can be overridden by the skin though.
52
53
--- test/markdown-test3.md
+++ test/markdown-test3.md
@@ -43,10 +43,12 @@
43 Default skin renders label in red font and the main text in gray.
44 Other styling may also apply.
45
46 Inline footnotes are supported.(^These may be usefull for adding
47 <s>small</s> comments.)
48
49 This is a corner case that is rendered as [an empty footnote](^ [] ()).
50
51 If [undefined label is used][^] then red "`misref`" is emited instead of
52 a numeric marker.[^ see it yourself ]
53 This can be overridden by the skin though.
54
55

Keyboard Shortcuts

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