forked from commonmark/cmark
-
Notifications
You must be signed in to change notification settings - Fork 101
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
integrate changes from cmark-gfm 0.29.0.gfm.12 and gfm.13 #61
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The code for the table extension used the term 'marker row', but the spec calls it 'delimiter row'. This change normalizes the terminology so that it's consistent.
``` ../../../../ext/markly/autolink.c: In function ‘postprocess_text’: ../../../../ext/markly/autolink.c:364:31: warning: passing argument 1 of ‘validate_protocol’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 364 | if (validate_protocol("mailto:", data + start + offset + max_rewind, rewind, max_rewind)) { | ^~~~~~~~~ ../../../../ext/markly/commonmark.c: In function ‘S_render_node’: ../../../../ext/markly/autolink.c:299:36: note: expected ‘char *’ but argument is of type ‘const char *’ 299 | static bool validate_protocol(char protocol[], uint8_t *data, size_t rewind, size_t max_rewind) { | ~~~~~^~~~~~~~~~ ```
``` ../../../../ext/markly/commonmark.c:405:18: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 405 | emph_delim = "_"; | ^ ```
… deeply nested footnote definitions.
warning: assignment discards ‘const’ qualifier from pointer target type
warning: passing argument 1 of ‘validate_protocol’ discards ‘const’ qualifier from pointer target type
…o be recomputed during rendering.
In addition, fix a bug where the length of the literal value was calculated AFTER the actual literal string (null terminated) was allocated.
Co-authored-by: Phill MV <phillmv@github.com>
Create codeql.yml
Fix GHSL-2023-117, GHSL-2023-118, GHSL-2023-119
…on-0.29.0.12 Changelog and version bump for 0.29.0.12
Fix format specifier for printing a size_t
Expose CMARK_NODE_FOOTNOTE_DEFINITION literal value.
Normalize nomenclature: marker row vs. delimiter row
…on-0.29.0.13 Changelog and version bump for 0.29.0.13
rdar://112876969
daniel-grumberg
approved these changes
Jul 31, 2023
daniel-grumberg
pushed a commit
to daniel-grumberg/swift-cmark
that referenced
this pull request
Aug 1, 2023
* Normalize nomenclature: marker row vs. delimiter row The code for the table extension used the term 'marker row', but the spec calls it 'delimiter row'. This change normalizes the terminology so that it's consistent. * Update autolink.c ``` ../../../../ext/markly/autolink.c: In function ‘postprocess_text’: ../../../../ext/markly/autolink.c:364:31: warning: passing argument 1 of ‘validate_protocol’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 364 | if (validate_protocol("mailto:", data + start + offset + max_rewind, rewind, max_rewind)) { | ^~~~~~~~~ ../../../../ext/markly/commonmark.c: In function ‘S_render_node’: ../../../../ext/markly/autolink.c:299:36: note: expected ‘char *’ but argument is of type ‘const char *’ 299 | static bool validate_protocol(char protocol[], uint8_t *data, size_t rewind, size_t max_rewind) { | ~~~~~^~~~~~~~~~ ``` * Update commonmark.c ``` ../../../../ext/markly/commonmark.c:405:18: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 405 | emph_delim = "_"; | ^ ``` * Fix GHSL-2023-119: prevent quadratic performance by not allowing very deeply nested footnote definitions. * Fix GHSL-2023-117: store cell index on node so that it doesn't need to be recomputed during rendering. * Fix GHSL-2023-118: limit number of autocompleted table cells to prevent DOS. * Expose CMARK_NODE_FOOTNOTE_DEFINION literal value. In addition, fix a bug where the length of the literal value was calculated AFTER the actual literal string (null terminated) was allocated. * Update src/node.h Co-authored-by: Phill MV <phillmv@github.com> * Rename custom_int -> cell_index. * Add newline * Remove unnecessary scope. * Create codeql.yml * Changelog and version bump for 0.29.0.12 * Fix format specifier for printing a size_t * Changelog and version bump for 0.29.0.13 * move cell index into node_cell_data --------- Co-authored-by: Waldir Pimenta <waldyrious@gmail.com> Co-authored-by: Samuel Williams <samuel.williams@oriontransfer.co.nz> Co-authored-by: Kevin Backhouse <kevinbackhouse@github.com> Co-authored-by: Phill MV <phillmv@github.com> Co-authored-by: Bas Alberts <13686387+anticomputer@users.noreply.github.com> Co-authored-by: Bas Alberts <anticomputer@github.com>
daniel-grumberg
added a commit
that referenced
this pull request
Aug 1, 2023
* Normalize nomenclature: marker row vs. delimiter row The code for the table extension used the term 'marker row', but the spec calls it 'delimiter row'. This change normalizes the terminology so that it's consistent. * Update autolink.c ``` ../../../../ext/markly/autolink.c: In function ‘postprocess_text’: ../../../../ext/markly/autolink.c:364:31: warning: passing argument 1 of ‘validate_protocol’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 364 | if (validate_protocol("mailto:", data + start + offset + max_rewind, rewind, max_rewind)) { | ^~~~~~~~~ ../../../../ext/markly/commonmark.c: In function ‘S_render_node’: ../../../../ext/markly/autolink.c:299:36: note: expected ‘char *’ but argument is of type ‘const char *’ 299 | static bool validate_protocol(char protocol[], uint8_t *data, size_t rewind, size_t max_rewind) { | ~~~~~^~~~~~~~~~ ``` * Update commonmark.c ``` ../../../../ext/markly/commonmark.c:405:18: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 405 | emph_delim = "_"; | ^ ``` * Fix GHSL-2023-119: prevent quadratic performance by not allowing very deeply nested footnote definitions. * Fix GHSL-2023-117: store cell index on node so that it doesn't need to be recomputed during rendering. * Fix GHSL-2023-118: limit number of autocompleted table cells to prevent DOS. * Expose CMARK_NODE_FOOTNOTE_DEFINION literal value. In addition, fix a bug where the length of the literal value was calculated AFTER the actual literal string (null terminated) was allocated. * Update src/node.h * Rename custom_int -> cell_index. * Add newline * Remove unnecessary scope. * Create codeql.yml * Changelog and version bump for 0.29.0.12 * Fix format specifier for printing a size_t * Changelog and version bump for 0.29.0.13 * move cell index into node_cell_data --------- Co-authored-by: QuietMisdreavus <QuietMisdreavus@users.noreply.github.com> Co-authored-by: Waldir Pimenta <waldyrious@gmail.com> Co-authored-by: Samuel Williams <samuel.williams@oriontransfer.co.nz> Co-authored-by: Kevin Backhouse <kevinbackhouse@github.com> Co-authored-by: Phill MV <phillmv@github.com> Co-authored-by: Bas Alberts <13686387+anticomputer@users.noreply.github.com> Co-authored-by: Bas Alberts <anticomputer@github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves rdar://112876969
This PR merges in changes from the following cmark-gfm releases:
Most importantly, this resolves GHSA-w4qg-3vf7-m9x5 (a/k/a CVE-2023-37463) by resolving some quadratic complexity in the table parser and HTML printer.
I had to make some changes on top of GitHub's patch to integrate their table-cell calculation with our data storage for row- and column-span. The only changes in the merge commit resolved merge conflicts introduced by the rowspan/colspan feature; the real changes are in the last commit in this branch.
I've tested this with the repo's own tests (
make test
), in Swift-Markdown, and in Swift-DocC, and all of the tests from these repos still pass.