Add an option `--fuzz-corpus` that writes the test cases to separate
files including the options header, so they can be used as seed corpus
for fuzz testing.
Previously in parsing the repeated pattern `![[]()` the parser
repeatedly scanned to the beginning of the increasingly large
stack of bracketed delimiters, trying to set the link delimiters
to "inactive" to prevent links inside links.
This commit removes the `active` flag from the bracketed delimiters, and
adds a new boolean flag `no_link_openers` on subject. This can be
set to true after a link is matched, telling the parser not to
bother forming a link if it matches an open bracket. It is set
to false when a new link open bracket is added to the stack of
openers. This new approach avoids the need to traverse the stack
of open brackets.
Resolves CVE-2023-22486.
Ref: https://github.com/github/cmark-gfm/security/advisories/GHSA-r572-jvj2-3m8p#event-87337
We handle this the same way we handle the parallel issue with
declarations: if we reach the end of input without seeing `-->`,
we set a flag telling us not to try again.
The internal_offset member is only used for headings and can be moved
to struct cmark_heading. This reduces the size of struct cmark_node
from 112 to 104 bytes on 64-bit systems.
Fix quadratic behavior in the Commonmark renderer when determining the
tight list status in deeply nested inlines.
Instead of searching for the containing block, update the tight list
status when
- entering a child of a list item
- exiting a list
Fixes#431.
- Use a multiprocessing.Queue to actually get results from spawned
tests processes.
- Fix the allowed_failures test.
- Truncate actual output when printed.
- Prepare for testing pathological behavior of the Commonmark renderer.
Fix a regression introduced with commit ed0a4bf. Also test the first
delimiter against stack_bottom in process_emphasis. This happened to
work with the old code and only resulted in an unnecessary scan.
Fixes#424.
Bump the minimum required CMake to 3.7. CMake 3.1 is required for the `CMAKE_C_STANDARD` and `CMAKE_C_STANDARD_REQUIRED` options to take effect. Relying on CMake to control the compiler this way allows us to avoid having to rebuild the logic for detecting the appropriate flags and ensuring that the compiler is able to support the necessary language version.
When building with an older CMake, the generator expression is not
evaluated properly and embedded into the final output name which is
incorrect. This should repair the ability to build with an older CMake.
CMAKE_INSTALL_<dir> can be relative or absolute path, so it is wrong to
prefix CMAKE_INSTALL_PREFIX because if CMAKE_INSTALL_<dir> is set to an
absolute path it will result in a malformed path with two absolute paths
joined together:
$ cmake -DCMAKE_INSTALL_PREFIX=/foo/bar \
-D CMAKE_INSTALL_BINDIR=/foo/bar/bin \
-D CMAKE_INSTALL_LIBDIR=/foo/bar/lib \
-D CMAKE_INSTALL_INCLUDEDIR=/foo/bar/include \
..
$ cat src/libcmark.pc
prefix=/foo/bar
exec_prefix=/foo/bar
libdir=/foo/bar//foo/bar/lib
includedir=/foo/bar//foo/bar/include
...
The libdir and includedir should be set by either calculating the
directories relative to the prefix or by using the
CMAKE_INSTALL_FULL_<dir> variables from GNUInstallDirs.
The CMAKE_INSTALL_FULL_<dir> variables seem the simpler solution.