Skip to content
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

merge in changes from cmark-gfm 0.29.0.gfm.11 #51

Merged
merged 69 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
d5b1fac
[Autolink] Store positioning info for url_match
bdotdub Jul 8, 2020
4517fef
cmark-gfm-core-extensions: use stdbool.h instead of private header
ryantm Nov 25, 2021
73bb24f
Expose `cmark_node_parent_footnote_def`.
ioquatix Jan 17, 2022
f13693d
man: Switch --safe option for --unsafe in man page
keith-packard Jan 18, 2022
ef5a494
Fix -Wstrict-prototypes warnings
jeroen Oct 14, 2022
855bf90
get rid of deprecated function
eli-schwartz Oct 26, 2022
e08c552
extensions: avoid useless duplication of headers
eli-schwartz Oct 26, 2022
c262f15
fix: DLinks with unique targets should have unique labels
smockle Jan 25, 2023
1f30fbb
fix: Use 'written_footnote_ix' (index) in place of named tag
smockle Jan 25, 2023
4cc5541
fix: Use 'written_footnote_ix' (index) in place of named tag in subse…
smockle Jan 25, 2023
388ddec
feat: Output index in a data attribute
smockle Jan 26, 2023
4d25a31
Merge pull request #248 from ryantm/fix-include
phillmv Jan 31, 2023
d401ba5
Merge pull request #255 from keith-packard/man-unsafe-flag
phillmv Jan 31, 2023
b32a02f
Merge pull request #201 from bdotdub/patch-1
phillmv Jan 31, 2023
9d8ebd6
Merge pull request #285 from jeroen/strict-prototypes
phillmv Jan 31, 2023
32c8fe6
Merge branch 'master' into exportfile-gfm
phillmv Jan 31, 2023
52c5e07
Merge pull request #289 from eli-schwartz/exportfile-gfm
phillmv Jan 31, 2023
ef87602
Update src/cmark-gfm.h comment
phillmv Jan 31, 2023
7b4ed79
Merge pull request #254 from ioquatix/expose-cmark_node_parent_footno…
phillmv Jan 31, 2023
c32ef78
Merge pull request #307 from github/footnote-backref-labels
phillmv Jan 31, 2023
730b009
Fix strict prototype clang warning
huven Feb 12, 2023
9e0855d
Fix GHSL-2023-031: prevent quadratic performance by not allowing very…
kevinbackhouse Feb 22, 2023
5c75d23
Ignore nested STRONGs during rendering
gravypod Mar 4, 2023
c72487d
Keep a count of the number of open blocks.
kevinbackhouse Mar 5, 2023
aa73711
Early-terminate the loop in check_open_blocks when the current line i…
kevinbackhouse Mar 6, 2023
27ba3a4
Also handle CMARK_NODE_LIST
kevinbackhouse Mar 8, 2023
a97a478
fix test/regression.txt regression
vassudanagunta Mar 9, 2023
e27a52f
Also handle CMARK_NODE_CODE_BLOCK
kevinbackhouse Mar 10, 2023
b44f479
Also handle CMARK_NODE_HTML_BLOCK
kevinbackhouse Mar 14, 2023
e840cad
Copied prototype change to implementation
huven Mar 19, 2023
828322d
Update expected output
kevinbackhouse Mar 25, 2023
f7e31f8
Add MAX_INDENT for xml.
jgm Aug 23, 2020
763587e
Fix quadratic performance issue in list numbering.
kevinbackhouse Mar 28, 2023
78e1cc0
Add ancestor_extension field.
kevinbackhouse Mar 28, 2023
bd4f96e
Remove dead code
kevinbackhouse Mar 29, 2023
178943f
0.29.0.gfm.10 changelog
anticomputer Mar 31, 2023
05e3ddb
bump version string
anticomputer Mar 31, 2023
6e4493d
Fix GHSA-66g8-4hjf-77xh: don't run expense safety check which causes …
kevinbackhouse Feb 22, 2023
2300c1b
Merge pull request from GHSA-66g8-4hjf-77xh
anticomputer Mar 31, 2023
07a66c9
Merge pull request from GHSA-r8vr-c48j-fcc5
anticomputer Mar 31, 2023
bdabba4
Update changelog.txt
phillmv Mar 31, 2023
dcf6b38
Merge pull request #317 from github/0.29.0.gfm.10
phillmv Mar 31, 2023
d5b0cfb
Fuzz target for bracketed patterns, such as [[[[x]]]].
kevinbackhouse Mar 31, 2023
c4de252
Merge pull request #318 from kevinbackhouse/fuzz-quadratic-brackets
anticomputer Mar 31, 2023
6ab3e99
Partially revert "Remove dead code"
kevinbackhouse Apr 2, 2023
36f8112
Revert "Fix quadratic performance issue in list numbering."
kevinbackhouse Apr 2, 2023
f040422
Store list item index on the node during rendering, to avoid quadrati…
kevinbackhouse Apr 2, 2023
dc01f71
Revert "Also handle CMARK_NODE_HTML_BLOCK"
kevinbackhouse Apr 3, 2023
66a36c4
Revert "Also handle CMARK_NODE_CODE_BLOCK"
kevinbackhouse Apr 3, 2023
7f567e2
Revert "Also handle CMARK_NODE_LIST"
kevinbackhouse Apr 3, 2023
0656bf9
Revert "Early-terminate the loop in check_open_blocks when the curren…
kevinbackhouse Apr 3, 2023
1eda738
Revert "Keep a count of the number of open blocks."
kevinbackhouse Apr 3, 2023
e5040b1
Merge pull request #310 from huven/prototype-warning
kevinbackhouse Apr 3, 2023
e8b5864
Merge pull request #313 from vassudanagunta/issue-312
kevinbackhouse Apr 3, 2023
97fdfb1
Merge pull request #322 from kevinbackhouse/list-item-index
kevinbackhouse Apr 3, 2023
1971f30
Merge pull request #323 from kevinbackhouse/list-depth-limit
kevinbackhouse Apr 3, 2023
2aad29d
Merge pull request #324 from kevinbackhouse/list-depth-limit-cmark-gfm
kevinbackhouse Apr 3, 2023
9f8945c
Bump version and start Changelog for 0.29.0.gfm.11
anticomputer Apr 3, 2023
889867b
Update changelog.txt
kevinbackhouse Apr 3, 2023
f6e3ee1
Don't copy if endlen is too big.
kevinbackhouse Apr 5, 2023
ef63acf
Merge pull request #326 from kevinbackhouse/fuzz-quadratic-brackets-o…
kevinbackhouse Apr 5, 2023
9d9f630
Add other output formats to the quadratic fuzzer.
kevinbackhouse Apr 6, 2023
c8dcdc7
Merge pull request #327 from kevinbackhouse/fuzz-other-output-formats
kevinbackhouse Apr 6, 2023
5ddc775
Update changelog.txt
anticomputer Apr 6, 2023
fe3e846
Update changelog.txt
anticomputer Apr 6, 2023
1e23082
Merge pull request #325 from github/0.29.0.gfm.11-changelog
anticomputer Apr 6, 2023
ff4f6bf
Merge tag '0.29.0.gfm.11' into QuietMisdreavus/gfm.11
QuietMisdreavus Apr 6, 2023
af81c60
guard global safety check setting behind a lock
QuietMisdreavus Apr 6, 2023
6376383
Merge tag '0.29.0.gfm.11' into QuietMisdreavus/gfm.11
QuietMisdreavus Apr 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project(cmark-gfm)
set(PROJECT_VERSION_MAJOR 0)
set(PROJECT_VERSION_MINOR 29)
set(PROJECT_VERSION_PATCH 0)
set(PROJECT_VERSION_GFM 6)
set(PROJECT_VERSION_GFM 11)
set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.gfm.${PROJECT_VERSION_GFM})

include("FindAsan.cmake")
Expand Down
1 change: 1 addition & 0 deletions api_test/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1575,6 +1575,7 @@ int main() {
int retval;
test_batch_runner *runner = test_batch_runner_new();

cmark_enable_safety_checks(true);
version(runner);
constructor(runner);
accessors(runner);
Expand Down
41 changes: 41 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
[0.29.0.gfm.11]

* Improved fixes for polynomial time complexity issues per
https://github.com/github/cmark-gfm/security/advisories/GHSA-66g8-4hjf-77xh
(#323, #324)
* Added fuzzing target for bracketed patterns (#318)
* Fixed bug in list numbering introduced in
763587e8775350b8cb4a2aa0f4cec3685aa96e8b (#322) which caused list numbers
to increment by 2
* Fixed strict prototype clang warning (#310)
* Fixed regression test (#312)
* Added additional output formats to quadratic fuzzer (#327)
* Fixed buffer overflow in fuzzing harness (#326)

Note: these changes may lead to minor changes in expected output on plaintext
rendering of list items. Notably, blank lines may no longer delineate the start
of a list when rendering to plaintext due to changes in how the tight list status
is calculated.

[0.29.0.gfm.10]

* Fixed polynomial time complexity issue per
https://github.com/github/cmark-gfm/security/advisories/GHSA-r8vr-c48j-fcc5
* Fixed polynomial time complexity issues per
https://github.com/github/cmark-gfm/security/advisories/GHSA-66g8-4hjf-77xh

Note: these changes remove redundant bold tag nesting which may result
in existing rendering tests failing, e.g. rendering "____bold____" to html
will no longer yield "<p><strong><strong>bold</strong></strong></p>".

[0.29.0.gfm.9]

* Cleanup: Use of a private header was cleaned up (#248)
* Cleanup: Man page was updated (#255)
* Cleanup: Warnings for -Wstrict-prototypes were cleaned up (#285)
* Cleanup: We avoid header duplication (#289)

* We now store positioning info for url_match (#201)
* We now expose cmark_parent_footnote_def for non-C renderers (#254)
* Footnote aria-label text now reference the specific footnote backref, and we include a data-footnote-backref-idx attribute so the label can be internationalized in a downstream filter (#307)

[0.29.0.gfm.8]

* We restored backwards compatibility by deprecating the `cmark_init_standard_node_flags()` requirement, which is now a noop (#305)
Expand Down
13 changes: 2 additions & 11 deletions extensions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ include_directories(
${PROJECT_BINARY_DIR}/src
)

include (GenerateExportHeader)

include_directories(include ${CMAKE_CURRENT_BINARY_DIR})

set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE} -pg")
Expand All @@ -29,6 +27,7 @@ if (CMARK_SHARED)

set_target_properties(${LIBRARY} PROPERTIES
OUTPUT_NAME "cmark-gfm-extensions"
DEFINE_SYMBOL "cmark-gfm"
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.gfm.${PROJECT_VERSION_GFM}
VERSION ${PROJECT_VERSION})

Expand All @@ -38,9 +37,6 @@ if (CMARK_SHARED)
# Avoid name clash between PROGRAM and LIBRARY pdb files.
set_target_properties(${LIBRARY} PROPERTIES PDB_NAME cmark-gfm-extensions_dll)

generate_export_header(${LIBRARY}
BASE_NAME cmark-gfm-extensions)

list(APPEND CMARK_INSTALL ${LIBRARY})
target_link_libraries(${LIBRARY} libcmark-gfm)

Expand All @@ -51,6 +47,7 @@ if (CMARK_STATIC)

set_target_properties(${STATICLIBRARY} PROPERTIES
COMPILE_FLAGS "-DCMARK_GFM_STATIC_DEFINE -DCMARK_GFM_EXTENSIONS_STATIC_DEFINE"
DEFINE_SYMBOL "cmark-gfm"
POSITION_INDEPENDENT_CODE ON)

if (MSVC)
Expand All @@ -63,11 +60,6 @@ if (CMARK_STATIC)
VERSION ${PROJECT_VERSION})
endif(MSVC)

if (NOT CMARK_SHARED)
generate_export_header(${STATICLIBRARY}
BASE_NAME cmark-gfm-extensions)
endif()

list(APPEND CMARK_INSTALL ${STATICLIBRARY})
endif()

Expand All @@ -84,7 +76,6 @@ install(TARGETS ${CMARK_INSTALL}
if (CMARK_SHARED OR CMARK_STATIC)
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/include/cmark-gfm-core-extensions.h
${CMAKE_CURRENT_SOURCE_DIR}/include/extensions-export.h
DESTINATION include
)

Expand Down
5 changes: 5 additions & 0 deletions extensions/autolink.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,11 @@ static cmark_node *url_match(cmark_parser *parser, cmark_node *parent,
cmark_node *text = cmark_node_new_with_mem(CMARK_NODE_TEXT, parser->mem);
text->as.literal = url;
cmark_node_append_child(node, text);

node->start_line = text->start_line = node->end_line = text->end_line = cmark_inline_parser_get_line(inline_parser);

node->start_column = text->start_column = max_rewind - rewind;
node->end_column = text->end_column = cmark_inline_parser_get_column(inline_parser) - 1;

return node;
}
Expand Down
30 changes: 15 additions & 15 deletions extensions/include/cmark-gfm-core-extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,40 @@ extern "C" {
#endif

#include "cmark-gfm-extension_api.h"
#include "extensions-export.h"
#include "cmark-gfm_config.h" // for bool
#include "export.h"
#include <stdbool.h>
#include <stdint.h>

CMARK_GFM_EXTENSIONS_EXPORT
CMARK_GFM_EXPORT
void cmark_gfm_core_extensions_ensure_registered(void);

CMARK_GFM_EXTENSIONS_EXPORT
CMARK_GFM_EXPORT
uint16_t cmark_gfm_extensions_get_table_columns(cmark_node *node);

/** Sets the number of columns for the table, returning 1 on success and 0 on error.
*/
CMARK_GFM_EXTENSIONS_EXPORT
CMARK_GFM_EXPORT
int cmark_gfm_extensions_set_table_columns(cmark_node *node, uint16_t n_columns);

CMARK_GFM_EXTENSIONS_EXPORT
CMARK_GFM_EXPORT
uint8_t *cmark_gfm_extensions_get_table_alignments(cmark_node *node);

/** Sets the alignments for the table, returning 1 on success and 0 on error.
*/
CMARK_GFM_EXTENSIONS_EXPORT
CMARK_GFM_EXPORT
int cmark_gfm_extensions_set_table_alignments(cmark_node *node, uint16_t ncols, uint8_t *alignments);

CMARK_GFM_EXTENSIONS_EXPORT
CMARK_GFM_EXPORT
int cmark_gfm_extensions_get_table_row_is_header(cmark_node *node);

/** Sets the column span for the table cell, returning 1 on success and 0 on error.
*/
CMARK_GFM_EXTENSIONS_EXPORT
CMARK_GFM_EXPORT
int cmark_gfm_extensions_set_table_cell_colspan(cmark_node *node, unsigned colspan);

/** Sets the row span for the table cell, returning 1 on success and 0 on error.
*/
CMARK_GFM_EXTENSIONS_EXPORT
CMARK_GFM_EXPORT
int cmark_gfm_extensions_set_table_cell_rowspan(cmark_node *node, unsigned rowspan);

/**
Expand All @@ -50,7 +50,7 @@ int cmark_gfm_extensions_set_table_cell_rowspan(cmark_node *node, unsigned rowsp

Column span is only parsed when \c CMARK_OPT_TABLE_SPANS is set.
*/
CMARK_GFM_EXTENSIONS_EXPORT
CMARK_GFM_EXPORT
unsigned cmark_gfm_extensions_get_table_cell_colspan(cmark_node *node);

/**
Expand All @@ -61,22 +61,22 @@ unsigned cmark_gfm_extensions_get_table_cell_colspan(cmark_node *node);

Row span is only parsed when \c CMARK_OPT_TABLE_SPANS is set.
*/
CMARK_GFM_EXTENSIONS_EXPORT
CMARK_GFM_EXPORT
unsigned cmark_gfm_extensions_get_table_cell_rowspan(cmark_node *node);

/** Sets whether the node is a table header row, returning 1 on success and 0 on error.
*/
CMARK_GFM_EXTENSIONS_EXPORT
CMARK_GFM_EXPORT
int cmark_gfm_extensions_set_table_row_is_header(cmark_node *node, int is_header);

CMARK_GFM_EXTENSIONS_EXPORT
CMARK_GFM_EXPORT
bool cmark_gfm_extensions_get_tasklist_item_checked(cmark_node *node);
/* For backwards compatibility */
#define cmark_gfm_extensions_tasklist_is_checked cmark_gfm_extensions_get_tasklist_item_checked

/** Sets whether a tasklist item is "checked" (completed), returning 1 on success and 0 on error.
*/
CMARK_GFM_EXTENSIONS_EXPORT
CMARK_GFM_EXPORT
int cmark_gfm_extensions_set_tasklist_item_checked(cmark_node *node, bool is_checked);

#ifdef __cplusplus
Expand Down
60 changes: 0 additions & 60 deletions extensions/include/extensions-export.h

This file was deleted.

1 change: 1 addition & 0 deletions fuzz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ macro(fuzzer name)
endmacro()

fuzzer(fuzz_quadratic)
fuzzer(fuzz_quadratic_brackets)
7 changes: 6 additions & 1 deletion fuzz/fuzz_quadratic.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,13 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {

cmark_parser_feed(parser, markdown, markdown_size);
cmark_node *doc = cmark_parser_finish(parser);

free(cmark_render_html(doc, fuzz_config.options, NULL));
free(cmark_render_xml(doc, fuzz_config.options));
free(cmark_render_man(doc, fuzz_config.options, 80));
free(cmark_render_commonmark(doc, fuzz_config.options, 80));
free(cmark_render_plaintext(doc, fuzz_config.options, 80));
free(cmark_render_latex(doc, fuzz_config.options, 80));

cmark_node_free(doc);
cmark_parser_free(parser);
Expand Down
Loading