Fossil SCM

In parse_blockquote(), do not look for a fenced code block past the end of the input. When the block was a bare quote marker with no newline after it, one byte beyond the end was read.

dmestas 2026-11-12 04:04 UTC small-fixes
Commit a0484ca03c56080574e0a89c49b0c06c71b60ead523d221033d961ac80f5feea
1 file changed +1 -1
+1 -1
--- src/markdown.c
+++ src/markdown.c
@@ -1803,11 +1803,11 @@
18031803
** If this is a quoted fenced block, then set endFence to be the
18041804
** offset of the end of the fenced block.
18051805
*/
18061806
pre = prefix_quote(data,size);
18071807
pre += is_empty(data+pre,size-pre);
1808
- nb = prefix_fencedcode(data+pre,size-pre);
1808
+ nb = pre<size ? prefix_fencedcode(data+pre,size-pre) : 0;
18091809
if( nb ){
18101810
size_t i = 0;
18111811
char delim = data[pre];
18121812
for(end=pre+nb; end<size && i<nb; end++){
18131813
if( data[end]==delim ) i++; else i = 0;
18141814
--- src/markdown.c
+++ src/markdown.c
@@ -1803,11 +1803,11 @@
1803 ** If this is a quoted fenced block, then set endFence to be the
1804 ** offset of the end of the fenced block.
1805 */
1806 pre = prefix_quote(data,size);
1807 pre += is_empty(data+pre,size-pre);
1808 nb = prefix_fencedcode(data+pre,size-pre);
1809 if( nb ){
1810 size_t i = 0;
1811 char delim = data[pre];
1812 for(end=pre+nb; end<size && i<nb; end++){
1813 if( data[end]==delim ) i++; else i = 0;
1814
--- src/markdown.c
+++ src/markdown.c
@@ -1803,11 +1803,11 @@
1803 ** If this is a quoted fenced block, then set endFence to be the
1804 ** offset of the end of the fenced block.
1805 */
1806 pre = prefix_quote(data,size);
1807 pre += is_empty(data+pre,size-pre);
1808 nb = pre<size ? prefix_fencedcode(data+pre,size-pre) : 0;
1809 if( nb ){
1810 size_t i = 0;
1811 char delim = data[pre];
1812 for(end=pre+nb; end<size && i<nb; end++){
1813 if( data[end]==delim ) i++; else i = 0;
1814

Keyboard Shortcuts

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