summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-06-29latex writer: fix memory overflow.John MacFarlane
We got an array overflow in enumerated lists nested more than 10 deep with start number =/= 1. Found by google/oss-fuzz. https://oss-fuzz.com/v2/testcase-detail/5546760854306816 This commit also ensures that we don't try to set `enum_` counters that aren't defined by LaTeX (generally up to enumv). Closes #210.
2017-06-29Makefile: add libFuzzer to phonyJohn MacFarlane
2017-06-27Merge pull request #209 from philipturnbull/libFuzzerJohn MacFarlane
Add libFuzzer harness for oss-fuzz
2017-06-27Check for NULL pointer in get_link_typePhil Turnbull
echo '[](xx:)' | ./build/src/cmark -t latex Segmentation fault: 11
2017-06-27Add Makefile target and harness to fuzz with libFuzzerPhil Turnbull
This can be run locally with `make libFuzzer` but the harness will be integrated into oss-fuzz for large-scale fuzzing.
2017-06-27Move fuzzing dictionary into single filePhil Turnbull
This allows AFL and libFuzzer to use the same dictionary
2017-06-23Add hyphen to dictionaryPhil Turnbull
2017-06-23Merge pull request #207 from github/upstream/oob-readJohn MacFarlane
Reset bytes after (possible) UTF8 proc
2017-06-23Reset bytes after UTF8 procYuki Izumi
See https://github.com/jgm/cmark/issues/206.
2017-06-21Merge pull request #205 from github/dont-scan-past-eolJohn MacFarlane
Don't scan past an EOL. The existing negated character classes ([^…]) are careful to always include \x00 in the characters excluded, but these . catch-alls can scan right past the terminating NUL placed at the end of the buffer by _scan_at. As such, buffer overruns can occur. Also, don't scan past a newline in HTML block end scanners.
2017-06-21Don't scan past newline eitherYuki Izumi
2017-06-21Don't scan past an EOLYuki Izumi
2017-06-02Merge pull request #195 from github/revert-194-upstream/remove-normalizeJohn MacFarlane
Revert "Remove normalize as an option per #190"
2017-06-02Document cases where get_ functions return NULL.John MacFarlane
E.g. cmark_node_get_url on a non-link or image. Closes #155.
2017-06-02Properly handle backslashes in link destinations.John MacFarlane
Only ascii punctuation characters are escapable, per the spec. Closes #192.
2017-06-02Fixed bug with unescaped left angle bracket in link destination.John MacFarlane
Closes #193.
2017-06-02Fixed cmark_node_get_list_start to return 0 for bullet lists...John MacFarlane
as documented! Closes #202.
2017-05-30Use CMARK_NO_DELIM for bullet lists. Closes #201.John MacFarlane
2017-05-18Merge pull request #198 from PavloKapyshin/masterJohn MacFarlane
Improve readme a bit
2017-05-16Add link to Python wrapperPavlo Kapyshin
2017-05-16Prettify languages listPavlo Kapyshin
2017-05-15README: Add link to cmark-scala (#196)Tim Nieradzik
2017-05-07Re-add CMARK_OPT_NORMALIZE without effect.Yuki Izumi
2017-05-05Remove normalize as an option per #190 (#194)Yuki Izumi
2017-04-03Fixed code for freeing delimiter stack.John MacFarlane
Note, however, that this may not be needed at all: the old code would have gone into an infinite loop if the delimiter stack were not already freed. If we can prove that the delimiter stack is empty at this point, we could remove this; on the other hand, it may not hurt to keep it here defensively. Closes #189.
2017-04-03Removed abort outside of conditional (typo).John MacFarlane
2017-04-03Removed coercion in error message when aborting from buffer.John MacFarlane
2017-04-03Print message to stderr when we abort due to memory demands.John MacFarlane
Closes #188. @nwellnhof - could you have a look and let me know if you think this is a bad idea or could be improved?
2017-02-05libcmark.pc: use CMAKE_INSTALL_LIBDIR (#185)Jens Petersen
needed for multilib distros like Fedora
2017-01-20Fixed buffer overflow error in S_parser_feed.John MacFarlane
The overflow could occur in the following condition: the buffer ends with `\r` and the next memory address contains `\n`. Closes #184.
2017-01-08Update emphasis parsing for spec change.John MacFarlane
Strong now goes inside Emph rather than the reverse, when both scopes are possible. The code is much simpler. This also avoids a spec inconsistency that cmark had previously: `***hi***` became Strong (Emph "hi")) but `***hi****` became Emph (Strong "hi")) "*"
2017-01-08Update spec.John MacFarlane
2017-01-07Fixes for the LaTeX renderer (#182)Doeme
* Don't double-output the link in latex-rendering. * Prevent ligatures in dashes sensibly when rendering latex. \- is a hyphenation, so it doesn't get displayed at all. * Redo "Don't double-output the link in latex-rendering." This reverts commit 8fb1f1c3c8799628141780ca5fd8d70883c1ec53 and adds the proper solution to the problem. With commit 8fb1f1c3c double rendering is fixed, but the url isn't escaped anymore, so I discarded the wrong copy. We now return 0 from the function in case of a single link, which stops processing the contents of the node. * Add a comment about the double-rendering issue addressed in 1c0d4749451cf85a849a3cf8e41cf137789821d4
2017-01-06Merge pull request #179 from winterheart/cmakeJohn MacFarlane
CMake impovement
2017-01-06Make shared and static libraries optionalAzamat H. Hackimov
Now you can enable/disable compilation and installation targets for shared and static libraries via -DCMARK_SHARED=ON/OFF and -DCMARK_STATIC=ON/OFF
2017-01-06Added support for built-in ${LIB_SUFFIX} featureAzamat H. Hackimov
Replaced ${LIB_INSTALL_DIR} option with built-in ${LIB_SUFFIX} for installing for 32/64-bit systems. Normally, CMake will set ${LIB_SUFFIX} automatically for required enviroment. If you have any issues with it, you can override this option with -DLIB_SUFFIX=64 or -DLIB_SUFFIX="" during configuration.
2017-01-05Automatic code reformatting.John MacFarlane
2017-01-05Added a test for NULL when freeing subj->last_delim.John MacFarlane
Noticed the need for this through fuzzing.
2017-01-05Cleaned up setting of lower bounds for openers.John MacFarlane
We now use a much smaller array.
2017-01-03Fixes #178, quadratic parsing bug.John MacFarlane
2017-01-03Added pathological test for #178 (quadratic).John MacFarlane
The new "multiple of 3" rule defeats one of our optimizations.
2017-01-03Slight improvement of clarity of logic in emph matching.John MacFarlane
2017-01-03Added regression test for #177.John MacFarlane
2017-01-03Revert "More sourcepos! (#169)"John MacFarlane
This reverts commit 9e643720ec903f3b448bd2589a0c02c2514805ae.
2017-01-03Revert "wrapper.py: remove unused (and faulty) libc instantiation (#175)"John MacFarlane
This reverts commit c4c1d59ca29aceb1c5919908ac97d9476264fd96.
2017-01-03Revert "Update cmark.3 man page."John MacFarlane
This reverts commit 26182bb868d3da7dd8a3389729bea79d489855b7.
2017-01-03Revert "Change types for source map offsets (#174)"John MacFarlane
This reverts commit 4fbe344df43ed7f60a3d3a53981088334cb709fc.
2017-01-03Fix "multiple of 3" determination in emph/strong parsing.John MacFarlane
We need to store the length of the original delimiter run, instead of using the length of the remaining delimiters after some have been subtracted. Test case: a***b* c* Thanks to Raph Levin for reporting.
2016-12-30Update cmark.3 man page.John MacFarlane
2016-12-30Change types for source map offsets (#174)Nick Wellnhofer
* Improve strbuf guarantees Introduce BUFSIZE_MAX macro and make sure that the strbuf implementation can handle strings up to this size. * Abort early if document size exceeds internal limit * Change types for source map offsets Switch to size_t for the public API, making the public headers C89-compatible again. Switch to bufsize_t internally, reducing memory usage and improving performance on 32-bit platforms. * Make parser return NULL on internal index overflow Make S_parser_feed set an error and ignore subsequent chunks if the total input document size exceeds an internal limit. Make cmark_parser_finish return NULL if an error was encountered. Add public API functions to retrieve error code and error message. strbuf overflow in renderers and OOM in parser or renderers still cause an abort.