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.
Commit
cab8a586ae5062c81514744db742d191f7caa554120c7876ead00c293d687ea3
Parent
d38ec43d00550b8…
2 files changed
+1
-1
+2
+1
-1
| --- src/markdown_html.c | ||
| +++ src/markdown_html.c | ||
| @@ -483,11 +483,11 @@ | ||
| 483 | 483 | #define _joined_footnote_indicator "<ul class='fn-joined'>" |
| 484 | 484 | #define _jfi_sz (sizeof(_joined_footnote_indicator)-1) |
| 485 | 485 | /* make.footnote_item() invocations should pass args accordingly */ |
| 486 | 486 | const struct Blob *upc = text+1; |
| 487 | 487 | assert( text ); |
| 488 | - assert( blob_size(text) ); | |
| 488 | + /* allow blob_size(text)==0 for constructs like [...](^ [] ()) */ | |
| 489 | 489 | memset(pos,0,24); |
| 490 | 490 | sprintf(pos, "%s-%d", unique, iMark); |
| 491 | 491 | blob_appendf(ob, "<li id='footnote%s' class='", pos); |
| 492 | 492 | if( nUsed ){ |
| 493 | 493 | if( blob_size(text)>=_jfi_sz && |
| 494 | 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 | 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 @@ | ||
| 43 | 43 | Default skin renders label in red font and the main text in gray. |
| 44 | 44 | Other styling may also apply. |
| 45 | 45 | |
| 46 | 46 | Inline footnotes are supported.(^These may be usefull for adding |
| 47 | 47 | <s>small</s> comments.) |
| 48 | + | |
| 49 | +This is a corner case that is rendered as [an empty footnote](^ [] ()). | |
| 48 | 50 | |
| 49 | 51 | If [undefined label is used][^] then red "`misref`" is emited instead of |
| 50 | 52 | a numeric marker.[^ see it yourself ] |
| 51 | 53 | This can be overridden by the skin though. |
| 52 | 54 | |
| 53 | 55 |
| --- 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 |