-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix table cannot be recoginsed without empty line #154
Fix table cannot be recoginsed without empty line #154
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great -- thank you so much. I'm going to run some fuzzing on this to make sure it holds up OK, but it looks good to me. 👍
test/extensions.txt
Outdated
@@ -150,7 +150,7 @@ Hello! | |||
|
|||
| _abc_ | セン | | |||
| ----- | ---- | | |||
| this row has a space at the end | | | |||
| this row has a space at the end | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| this row has a space at the end | | | |
| this row has a space at the end | | |
This was probably removed by accident.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is "whitespace trimming" on vscode ❤️
|
||
paragraph = cmark_node_new_with_mem(CMARK_NODE_PARAGRAPH, parser->mem); | ||
|
||
paragraph_content = unescape_pipes(parser->mem, parent_string, paragraph_offset); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed redundant type conversions 7f69c4e
`cmark_node_set_string_content` allocates and copies the data in `paragraph_content` so it is not needed afterwards. ``` ================================================================= ==14==ERROR: LeakSanitizer: detected memory leaks Direct leak of 24 byte(s) in 1 object(s) allocated from: 0 0x4dd330 in calloc /src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:97 1 0x59e243 in xcalloc /src/octofuzz/src/cmark.c:18:15 2 0x58fd75 in unescape_pipes /src/octofuzz/extensions/table.c:95:39 3 0x58fd75 in try_inserting_table_header_paragraph /src/octofuzz/extensions/table.c:187 4 0x58fd75 in try_opening_table_header /src/octofuzz/extensions/table.c:254 5 0x58fd75 in try_opening_table_block /src/octofuzz/extensions/table.c:370 6 0x5b22d5 in open_new_blocks /src/octofuzz/src/blocks.c:1275:27 7 0x5b22d5 in S_process_line /src/octofuzz/src/blocks.c:1465 8 0x5aa7f0 in cmark_parser_finish /src/octofuzz/src/blocks.c:1492:5 9 0x58f2fc in LLVMFuzzerTestOneInput /src/octofuzz/test/cmark-fuzz.c:46:23 Indirect leak of 8 byte(s) in 1 object(s) allocated from: 0 0x4dd580 in realloc /src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:107 1 0x59e2d3 in xrealloc /src/octofuzz/src/cmark.c:27:19 2 0x640364 in cmark_strbuf_grow /src/octofuzz/src/buffer.c:57:31 3 0x640364 in cmark_strbuf_init /src/octofuzz/src/buffer.c:31 4 0x58fd8b in unescape_pipes /src/octofuzz/extensions/table.c:98:3 5 0x58fd8b in try_inserting_table_header_paragraph /src/octofuzz/extensions/table.c:187 6 0x58fd8b in try_opening_table_header /src/octofuzz/extensions/table.c:254 7 0x58fd8b in try_opening_table_block /src/octofuzz/extensions/table.c:370 8 0x5b22d5 in open_new_blocks /src/octofuzz/src/blocks.c:1275:27 9 0x5b22d5 in S_process_line /src/octofuzz/src/blocks.c:1465 10 0x5aa7f0 in cmark_parser_finish /src/octofuzz/src/blocks.c:1492:5 11 0x58f2fc in LLVMFuzzerTestOneInput /src/octofuzz/test/cmark-fuzz.c:46:23 SUMMARY: AddressSanitizer: 32 byte(s) leaked in 2 allocation(s). ```
I've pushed 15e924d from @philipturnbull, who found a memory leak while fuzzing this branch. |
@jinhucheung Thank you for your PR! |
See github/cmark-gfm#154. This was my doing 🤦♀️
* fix(table): recoginse-without-empty-line (#141) * fix(table): fix bufsize_t not convert to uint16_t * fix(table): fix uint16_6 not convert to int * fix(table): fix uint16_6 not convert to int * fix(table): clear unused type conversion * restore whitespace * Always free `paragraph_content` `cmark_node_set_string_content` allocates and copies the data in `paragraph_content` so it is not needed afterwards. ``` ================================================================= ==14==ERROR: LeakSanitizer: detected memory leaks Direct leak of 24 byte(s) in 1 object(s) allocated from: 0 0x4dd330 in calloc /src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:97 1 0x59e243 in xcalloc /src/octofuzz/src/cmark.c:18:15 2 0x58fd75 in unescape_pipes /src/octofuzz/extensions/table.c:95:39 3 0x58fd75 in try_inserting_table_header_paragraph /src/octofuzz/extensions/table.c:187 4 0x58fd75 in try_opening_table_header /src/octofuzz/extensions/table.c:254 5 0x58fd75 in try_opening_table_block /src/octofuzz/extensions/table.c:370 6 0x5b22d5 in open_new_blocks /src/octofuzz/src/blocks.c:1275:27 7 0x5b22d5 in S_process_line /src/octofuzz/src/blocks.c:1465 8 0x5aa7f0 in cmark_parser_finish /src/octofuzz/src/blocks.c:1492:5 9 0x58f2fc in LLVMFuzzerTestOneInput /src/octofuzz/test/cmark-fuzz.c:46:23 Indirect leak of 8 byte(s) in 1 object(s) allocated from: 0 0x4dd580 in realloc /src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:107 1 0x59e2d3 in xrealloc /src/octofuzz/src/cmark.c:27:19 2 0x640364 in cmark_strbuf_grow /src/octofuzz/src/buffer.c:57:31 3 0x640364 in cmark_strbuf_init /src/octofuzz/src/buffer.c:31 4 0x58fd8b in unescape_pipes /src/octofuzz/extensions/table.c:98:3 5 0x58fd8b in try_inserting_table_header_paragraph /src/octofuzz/extensions/table.c:187 6 0x58fd8b in try_opening_table_header /src/octofuzz/extensions/table.c:254 7 0x58fd8b in try_opening_table_block /src/octofuzz/extensions/table.c:370 8 0x5b22d5 in open_new_blocks /src/octofuzz/src/blocks.c:1275:27 9 0x5b22d5 in S_process_line /src/octofuzz/src/blocks.c:1465 10 0x5aa7f0 in cmark_parser_finish /src/octofuzz/src/blocks.c:1492:5 11 0x58f2fc in LLVMFuzzerTestOneInput /src/octofuzz/test/cmark-fuzz.c:46:23 SUMMARY: AddressSanitizer: 32 byte(s) leaked in 2 allocation(s). ```
fix #141