diff options
author | John MacFarlane <jgm@berkeley.edu> | 2016-02-10 09:51:54 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2016-02-10 09:52:44 -0800 |
commit | f9565289ff6375218662c9f85b3239b38ee58e8d (patch) | |
tree | e76edf53443c6226b2158aae65f959d03cfe4f4d /src | |
parent | b73bcedabb2ca6f06b2e96c410a603416ce17029 (diff) |
Revert "Simplified condition for lazy line."
This reverts commit 4d2d486333c358eb3adf3d0649163e319a3b8b69.
This commit caused a valgrind invalid read.
==29731== Invalid read of size 4
==29731== at 0x40500E: S_process_line (blocks.c:1050)
==29731== by 0x403CF7: S_parser_feed (blocks.c:526)
==29731== by 0x403BC9: cmark_parser_feed (blocks.c:494)
==29731== by 0x433A95: main (main.c:168)
==29731== Address 0x51d5b60 is 64 bytes inside a block of size 128 free'd
==29731== at 0x4C27D4E: free (vg_replace_malloc.c:427)
==29731== by 0x4015F0: S_free_nodes (node.c:134)
==29731== by 0x401634: cmark_node_free (node.c:142)
==29731== by 0x4033B1: finalize (blocks.c:259)
==29731== by 0x40365E: add_child (blocks.c:337)
==29731== by 0x4046D8: try_new_container_starts (blocks.c:836)
==29731== by 0x404F12: S_process_line (blocks.c:1015)
==29731== by 0x403CF7: S_parser_feed (blocks.c:526)
==29731== by 0x403BC9: cmark_parser_feed (blocks.c:494)
==29731== by 0x433A95: main (main.c:168)
Diffstat (limited to 'src')
-rw-r--r-- | src/blocks.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/blocks.c b/src/blocks.c index c4593bf..fdf1106 100644 --- a/src/blocks.c +++ b/src/blocks.c @@ -1047,10 +1047,10 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer, // and the line isn't blank, // then treat this as a "lazy continuation line" and add it to // the open paragraph. - if (parser->current->type == CMARK_NODE_PARAGRAPH && - parser->current != last_matched_container && - container == last_matched_container && - !parser->blank) { + if (parser->current != last_matched_container && + container == last_matched_container && !parser->blank && + parser->current->type == CMARK_NODE_PARAGRAPH && + cmark_strbuf_len(&parser->current->string_content) > 0) { add_line(parser->current, &input, parser); } else { // not a lazy continuation // Finalize any blocks that were not matched and set cur to container: |