Releases: commonmark/cmark
cmark 0.28.0
-
Update spec.
-
Use unsigned integer when shifting (Phil Turnbull).
Avoids a UBSAN warning which can be triggered when handling a
long sequence of backticks. -
Avoid memcpy'ing NULL pointers (Phil Turnbull).
Avoids a UBSAN warning when link title is empty string.
The length of the memcpy is zero so the NULL pointer is not
dereferenced but it is still undefined behaviour. -
DeMorgan simplification of some tests in emphasis parser.
This also brings the code into closer alignment with the wording
of the spec (see commonmark/commonmark-spec#467). -
Fixed undefined shift in commonmark writer (#211).
Found by google/oss-fuzz:
https://oss-fuzz.com/v2/testcase-detail/4686992824598528. -
latex writer: fix memory overflow (#210).
We got an array overflow in enumerated lists nested more than
10 deep with start number =/= 1.
This commit also ensures that we don't try to setenum_
counters
that aren't defined by LaTeX (generally up to enumv).
Found by google/oss-fuzz:
https://oss-fuzz.com/v2/testcase-detail/5546760854306816. -
Check for NULL pointer in get_link_type (Phil Turnbull).
echo '[](xx:)' | ./build/src/cmark -t latex
gave a
segfault. -
Move fuzzing dictionary into single file (Phil Turnbull).
This allows AFL and libFuzzer to use the same dictionary -
Reset bytes after UTF8 proc (Yuki Izumi, #206).
-
Don't scan past an EOL (Yuki Izumi).
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. -
Document cases where
get_
functions returnNULL
(#155).
E.g.cmark_node_get_url
on a non-link or image. -
Properly handle backslashes in link destinations (#192).
Only ascii punctuation characters are escapable, per the spec. -
Fixed
cmark_node_get_list_start
to return 0 for bullet lists,
as documented (#202). -
Use
CMARK_NO_DELIM
for bullet lists (#201). -
Fixed code for freeing delimiter stack (#189).
-
Removed abort outside of conditional (typo).
-
Removed coercion in error message when aborting from buffer.
-
Print message to stderr when we abort due to memory demands (#188).
-
libcmark.pc
: useCMAKE_INSTALL_LIBDIR
(#185, Jens Petersen).
Needed for multilib distros like Fedora. -
Fixed buffer overflow error in
S_parser_feed
(#184).
The overflow could occur in the following condition:
the buffer ends with\r
and the next memory address
contains\n
. -
Update emphasis parsing for spec change.
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")) "*" -
Fixes 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.
-
Added a test for NULL when freeing
subj->last_delim
. -
Cleaned up setting of lower bounds for openers.
We now use a much smaller array. -
Fix #178, quadratic parsing bug. Add pathological test.
-
Slight improvement of clarity of logic in emph matching.
-
Fix "multiple of 3" determination in emph/strong parsing.
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. -
Correctly initialize chunk in S_process_line (Nick Wellnhofer, #170).
Thealloc
member wasn't initialized. This also allows to add an
assertion inchunk_rtrim
which doesn't work for alloced chunks. -
Added 'make newbench'.
-
scanners.c
generated with re2c 0.16 (68K smaller!). -
scanners.re
- fixed warnings; use*
for fallback. -
Fixed some warnings in
scanners.re
. -
Update CaseFolding to latest (Kevin Wojniak, #168).
-
Allow balanced nested parens in link destinations (Yuki Izumi, #166)
-
Allocate enough bytes for backticks array.
-
Inlines: Ensure that the delimiter stack is freed in subject.
-
Fixed pathological cases with backtick code spans:
-
Removed recursion in scan_to_closing_backticks
-
Added an array of pointers to potential backtick closers
to subject -
This array is used to avoid traversing the subject again
when we've already seen all the potential backtick closers. -
Added a max bound of 1000 for backtick code span delimiters.
-
This helps with pathological cases like:
x x ` x `` x ``` x ```` ...
-
Added pathological test case.
Thanks to Martin Mitáš for identifying the problem and for
discussion of solutions. -
-
Make shared and static libraries optional (Azamat 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
. -
Added support for built-in
${LIB_SUFFIX}
feature (Azamat 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. -
Add Makefile target and harness to fuzz with libFuzzer (Phil Turnbull).
This can be run locally withmake libFuzzer
but the harness will be
integrated into oss-fuzz for large-scale fuzzing. -
Advertise
--validate-utf8
in usage information
(Nguyễn Thái Ngọc Duy). -
Makefile: use warnings with re2c.
-
README: Add link to Python wrapper, prettify languages list
(Pavlo Kapyshin). -
README: Add link to cmark-scala (Tim Nieradzik, #196)
cmark 0.27.1
- Set policy for CMP0063 to avoid a warning (#162).
Put set_policy under cmake version test.
Otherwise we get errors in older versions of cmake. - Use VERSION_GREATER to clean up cmake version test.
- Improve afl target. Use afl-clang by default. Set default for path.
cmark 0.27.0
- Update spec to 0.27.
- Fix warnings building with MSVC on Windows (#165, Hugh Bellamy).
- Fix
CMAKE_C_VISIBILITY_PRESET
for cmake versions greater than 1.8
(e.g. 3.6.2) (#162, Hugh Bellamy). This lets us build swift-cmark
on Windows, using clang-cl. - Fix for non-matching entities (#161, Yuki Izumi).
- Modified
print_delimiters
(commented out) so it compiles again. make format
: don't change order of includes.- Changed logic for null/eol checks (#160).
- only check once for "not at end of line"
- check for null before we check for newline characters (the
previous patch would fail for NULL + CR)
- Fix by not advancing past both
\0
and\n
(Yuki Izumi). - Add test for NUL-LF sequence (Yuki Izumi).
- Fix memory leak in list parsing (Yuki Izumi).
- Use
cmark_mem
to free where used to alloc (Yuki Izumi). - Allow a shortcut link before a
(
(commonmark/commonmark-spec#427). - Allow tabs after setext header line (commonmark/commonmark.js#109).
- Don't let URI schemes start with spaces.
- Fixed h2..h6 HTML blocks (commonmark/commonmark-spec#430). Added regression test.
- Autolink scheme can contain digits (Gábor Csárdi).
- Fix nullary function declarations in cmark.h (Nick Wellnhofer).
Fixes strict prototypes warnings. - COPYING: Update file name and remove duplicate section and
(Peter Eisentraut). - Fix typo (Pavlo Kapyshin).
cmark 0.26.1
- Removed unnecessary typedef that caused build failure on
some platforms. - Use
$(MAKE)
in Makefile instead of hardcodedmake
(#146,
Tobias Kortkamp).
cmark 0.26.0
- Implement spec changes for list items:
- Empty list items cannot interrupt paragraphs.
- Ordered lists cannot interrupt paragraphs unless
they start with 1. - Removed "two blank lines break out of a list" feature.
- Fix sourcepos for blockquotes (#142).
- Fix sourcepos for atx headers (#141).
- Fix ATX headers and thematic breaks to allow tabs as well as spaces.
- Fix
chunk_set_cstr
with suffix of current string (#139,
Nick Wellnhofer). It's possible thatcmark_chunk_set_cstr
is called
with a substring (suffix) of the current string. Delay freeing of the
chunk content to handle this case correctly. - Export targets on installation (Jonathan Müller).
This allows using them in other cmake projects. - Fix cmake warning about CMP0048 (Jonathan Müller).
- commonmark renderer: Ensure we don't have a blank line
before a code block when it's the first thing in a list
item. - Change parsing of strong/emph in response to spec changes.
process_emphasis
now gets better results in corner cases.
The change is this: when considering matches between an interior
delimiter run (one that can open and can close) and another delimiter
run, we require that the sum of the lengths of the two delimiter
runs mod 3 is not 0. - Ported Robin Stocker's changes to link parsing in commonmark/commonmark-spec#101.
This uses a separate stack for brackets, instead of putting them on the
delimiter stack. This avoids the need for looking through the delimiter
stack for the next bracket. cmark_reference_lookup
: Return NULL if reference is null string.- Fix character type detection in
commonmark.c
(Nick Wellnhofer).
Fixes test failures on Windows and undefined behavior.- Implement
cmark_isalpha
. - Check for ASCII character before implicit cast to char.
- Use internal ctype functions in
commonmark.c
.
- Implement
- Better documentation of memory-freeing responsibilities.
incmark.h
and its man page (#124). - Use library functions to insert nodes in emphasis/link processing.
Previously we did this manually, which introduces many
places where errors can creep in. - Correctly handle list marker followed only by spaces.
Previously when a list marker was followed only by spaces,
cmark expected the following content to be indented by
the same number of spaces. But in this case we should
treat the line just like a blank line and set list padding
accordingly. - Fixed a number of issues relating to line wrapping.
- Extend
CMARK_OPT_NOBREAKS
to all renderers and add--nobreaks
. - Do not autowrap, regardless of width parameter, if
CMARK_OPT_NOBREAKS
is set. - Fixed
CMARK_OPT_HARDBREAKS
for LaTeX and man renderers. - Ensure that no auto-wrapping occurs if
CMARK_OPT_NOBREAKS
is enabled, or if output is CommonMark and
CMARK_OPT_HARDBREAKS
is enabled.
- Extend
- Set stdin to binary mode on Windows (Nick Wellnhofer, #113).
This fixes EOLs when reading from stdin. - Add library option to render softbreaks as spaces (Pavlo
Kapyshin). Note that theNOBREAKS
option is HTML-only - renderer:
no_linebreaks
instead ofno_wrap
.
We generally want this option to prohibit any breaking
in things like headers (not just wraps, but softbreaks). - Coerce
realurllen
toint
. This is an alternate solution for pull
request #132, which introduced a new warning on the comparison
(Benedict Cohen). - Remove unused variable
link_text
(Mathiew Duponchelle). - Improved safety checks in buffer (Vicent Marti).
- Add new interface allowing specification of custom memory allocator
for nodes (Vicent Marti). Addedcmark_node_new_with_mem
,
cmark_parser_new_with_mem
,cmark_mem
to API. - Reduce storage size for nodes by using bit flags instead of
separate booleans (Vicent Marti). - config: Add
SSIZE_T
compat for Win32 (Vicent Marti). - cmake: Global handler for OOM situations (Vicent Marti).
- Add tests for memory exhaustion (Vicent Marti).
- Document in man page and public header that one should use the same
memory allocator for every node in a tree. - Fix ctypes in Python FFI calls (Nick Wellnhofer). This didn't cause
problems so far because all types are 32-bit on 32-bit systems and
arguments are passed in registers on x86-64. The wrong types could cause
crashes on other platforms, though. - Remove spurious failures in roundtrip tests. In the commonmark writer we
separate lists, and lists and indented code, using a dummy HTML comment.
So in evaluating the round-trip tests, we now strip out
these comments. We also normalize HTML to avoid issues
having to do with line breaks. - Add 2016 to copyright (Kevin Burke).
- Added
to_commonmark
intest/cmark.py
(for round-trip tests). spec_test.py
- parameterizedo_test
with converter.spec_tests.py
: exit code is now sum of failures and errors.
This ensures that a failing exit code will be given when
there are errors, not just with failures.- Fixed round trip tests. Previously they actually ran
cmark
instead of the round-trip version, since there was a bug in
setting the ROUNDTRIP variable (#131). - Added new
roundtrip_tests.py
. This replaces the old use of simple shell
scripts. It is much faster, and more flexible. (We will be able
to do custom normalization and skip certain tests.) - Fix tests under MinGW (Nick Wellnhofer).
- Fix leak in
api_test
(Mathieu Duponchelle). - Makefile: have leakcheck stop on first error instead of going through
all the formats and options and probably getting the same output. - Add regression tests (Nick Wellnhofer).
cmark 0.25.2
- Open files in binary mode (#113, Nick Wellnhofer). Now that cmark
supports different line endings, files must be openend in binary mode
on Windows. - Reset
partially_consumed_tab
on every new line (#114, Nick Wellnhofer). - Handle buffer split across a CRLF line ending (#117). Adds an internal
field to the parser struct to keep track oflast_buffer_ended_with_cr
.
Added test.
cmark 0.25.1
- Release with no code changes. cmark version was mistakenly set to
0.25.1 in the 0.25.0 release (#112), so this release just
ensures that this will cause no confusion later.
cmark 0.25.0
-
Fixed tabs in indentation (#101). This patch fixes S_advance_offset
so that it doesn't gobble a tab character when advancing less than the
width of a tab. -
Added partially_consumed_tab to parser. This keeps track of when we
have gotten partway through a tab when consuming initial indentation. -
Simplified add_line (only need parser parameter).
-
Properly handle partially consumed tab. E.g. in
- foo <TAB><TAB>bar
we should consume two spaces from the second tab, including two spaces
in the code block. -
Properly handle tabs with blockquotes and fenced blocks.
-
Fixed handling of tabs in lists.
-
Clarified logic in S_advance_offset.
-
Use an assertion to check for in-range html_block_type.
It's a programming error if the type is out of range. -
Refactored S_processLines to make the logic easier to
understand, and added documentation (Mathieu Duponchelle). -
Removed unnecessary check for empty string_content.
-
Factored out contains_inlines.
-
Moved the cmake minimum version to top line of CMakeLists.txt
(tinysun212). -
Fix ctype(3) usage on NetBSD (Kamil Rytarowski). We need to cast value
passed to isspace(3) to unsigned char to explicitly prevent possibly
undefined behavior. -
Compile in plain C mode with MSVC 12.0 or newer (Nick Wellnhofer).
Under MSVC, we used to compile in C++ mode to get some C99 features
like mixing declarations and code. With newer MSVC versions, it's
possible to build in plain C mode. -
Switched from "inline" to "CMARK_INLINE" (Nick Wellnhofer).
Newer MSVC versions support enough of C99 to be able to compile cmark
in plain C mode. Only the "inline" keyword is still unsupported.
We have to use "__inline" instead. -
Added include guards to config.h
-
config.h.in - added compatibility snprintf, vsnprintf for MSVC.
-
Replaced sprintf with snprintf (Marco Benelli).
-
config.h: include stdio.h for _vscprintf etc.
-
Include starg.h when needed in config.h.
-
Removed an unnecessary C99-ism in buffer.c. This helps compiling on
systems like luarocks that don't have all the cmake configuration
goodness (thanks to carlmartus). -
Don't use variable length arrays (Nick Wellnhofer).
They're not supported by MSVC. -
Test with multiple MSVC versions under Appveyor (Nick Wellnhofer).
-
Fix installation dir of man-pages on NetBSD (Kamil Rytarowski).
-
Fixed typo in cmark.h comments (Chris Eidhof).
-
Clarify in man page that cmark_node_free frees a node's children too.
-
Fixed documentation of --width in man page.
-
Require re2c >= 1.14.2 (#102).
-
Generated scanners.c with more recent re2c.
cmark 0.24.1
- Commonmark renderer:
- Use HTML comment, not two blank lines, to separate a list
item from a following code block or list. This makes the
output more portable, since the "two blank lines" rule is
unique to CommonMark. Also, it allows us to break out of
a sublist without breaking out of all levels of nesting. is_autolink
- handle case where link has no children,
which previously caused a segfault.- Use 4-space indent for bullet lists, for increased portability.
- Use 2-space + newline for line break for increased portability (#90).
- Improved punctuation escaping. Previously all
)
and
.
characters after digits were escaped; now they are
only escaped if they are genuinely in a position where
they'd cause a list item. This is achieved by changes in
render.c
: (a)renderer->begin_content
is only set to
false after a string of digits at the beginning of the
line, and (b) we never break a line before a digit.
Also,begin_content
is properly initialized to true.
- Use HTML comment, not two blank lines, to separate a list
- Handle NULL root in
consolidate_text_nodes
.
cmark 0.24.0
- [API change] Added
cmark_node_replace(oldnode, newnode)
. - Updated spec.txt to 0.24.
- Fixed edge case with escaped parens in link destination (#97).
This was also checked against the #82 case with asan. - Removed unnecessary check for
fenced
incmark_render_html
.
It's sufficient to check that the info string is empty.
Indeed, those who use the API may well create a code block
with an info string without explicitly settingfenced
. - Updated format of
test/smart_punct.txt
. - Updated
test/spec.txt
,test/smart_punct.txt
, and
spec_tests.py
to new format. - Fixed
get_containing_block
logic insrc/commonmark.c
.
This did not allow for the possibility that a node might have no
containing block, causing the commonmark renderer to segfault if
passed an inline node with no block parent. - Fixed string representations of
CUSTOM_BLOCK
,
CUSTOM_INLINE
. The old versionsraw_inline
and
raw_block
were being used, and this led to incorrect xml output. - Use default opts in python sample wrapper.
- Allow multiline setext header content, as per spec.
- Don't allow spaces in link destinations, even with pointy brackets.
Conforms to latest change in spec. - Updated
scheme
scanner according to spec change. We no longer use
a whitelist of valid schemes. - Allow any kind of nodes as children of
CUSTOM_BLOCK
(#96). cmark.h
: moved typedefs for iterator into iterator section.
This just moves some code around so it makes more sense
to read, and in the man page.- Fixed
make_man_page.py
so it includes typedefs again.