Commit Graph

683 Commits

Author SHA1 Message Date
Martin Mitas
c6535ff3da Fix eof handling in a middle of task list item. 2024-01-10 21:39:24 +01:00
Martin Mitas
ebbb12e506 Revert most of PR #168
i.e of the commit f436c30298.

It added bunch of checks all over the place, but most of them
shouldn't be needed: If they are true, our internal state is
already broken. In other words, those checks are hiding real bugs
and making debugging harder.

Hopefully the underlying bugs are already fixed in some of previous
commits addressing some fuzzing issues, like these:

 * d775b5103e
 * c6942ef03e
2024-01-10 20:47:34 +01:00
Martin Mitas
d775b5103e More fixes of TABLECELLBOUNDARIES chain handling.
Fixes #213.
2024-01-10 18:33:32 +01:00
Martin Mitas
821477b1da Fix typo in fuzz-mdhtml.c, preventing oss-fuzz from working. 2024-01-10 17:35:46 +01:00
Martin Mitas
c6942ef03e Treat TABLECELLBOUNDARIES chain as special one.
It's not an ordinary openers chain as (most of) the others, and
md_rollback() must not touch it.

Fixes #212.
2024-01-10 17:33:06 +01:00
Martin Mitas
338e0bb2fb md2html: Add undoc'ed debug option --replay-fuzz.
This helps to reproduce issues found by oss-fuzz project.
2024-01-10 17:30:51 +01:00
Martin Mitas
ca169a92d5 Fix HTML renderer to handle neted images correctly.
Fixes #210.
2024-01-10 12:23:17 +01:00
Andreas Baumann
47a2ad3d93
added options --html-title and --html-css (#188) 2024-01-09 11:34:40 +01:00
Jens Alfke
efcfd7e7cd
Added MD_SPAN_A_DETAIL.is_autolink (#181)
This allows the processor to tell whether an <A> tag is the result of
an autolink, and customize its output. For example, I want to emit an
autolink of an image URL as an <IMG> tag, and an autolink of a YouTube
URL as a video embed.
2024-01-09 11:32:17 +01:00
Dylan Deng
ecce1715b7
add build option for md2html executable (#184)
Fixes build error for iOS, you can set BUILD_MD2HTML_EXECUTABLE as OFF

Signed-off-by: Dylan <2894220@gmail.com>
Co-authored-by: Martin Mitáš <mity@morous.org>
2024-01-09 11:30:01 +01:00
Martin Mitas
61949ee9d1 Update to Unicode 15.1. 2024-01-09 02:08:48 +01:00
Martin Mitas
38303af369 Make md_is_html_block_end_condition() reuse the same data...
... as md_is_html_block_start_condition() for the type 1 so we make all
tags are used consistently there.

Fixes #207.
2024-01-09 00:01:35 +01:00
Martin Mitas
8699cd5d8e test/hard-soft-breaks.txt: Fix wording. 2024-01-08 21:58:26 +01:00
Martin Mitas
319631f67e Don't merge multiple HTML blocks together.
Fixes #202.
2024-01-08 21:52:30 +01:00
l-m
6ef3be6e69
MD_FLAG_HARD_SOFT_BREAKS (#193) 2024-01-08 21:09:57 +01:00
Erich Erstu
4e5a6e6f22
Update README.md (#198)
Added MarkDown Monolith Assembler to the list of software that uses md4c.
2024-01-08 20:57:40 +01:00
step
f554bf1108
Don't trim HTML block lines (MD_LINE_HTML) (#206)
Markdown 0.30 doesn't mandate right-trimming the contents of HTML lines.
Doing so is more work and breaks output compatibility with cmark, tested
with https://github.com/commonmark/cmark/commit/9393560.
2024-01-08 20:55:54 +01:00
Martin Mitas
4d2f8a2e0b Add test for issue #201.
Seems the issue got fixed by combination of previous commits.

Fixes #201.
2024-01-08 19:35:53 +01:00
Martin Mitas
132c29dcd0 Allow indented code block to follow any block except paragraph without a blank line.
Fixes #200.
2024-01-08 19:31:37 +01:00
Martin Mitas
601c8ab70e Restore parent's block indentation when interruping a list item with double blank line.
Fixes #190.
2024-01-08 19:27:16 +01:00
Martin Mitas
bf2e7d30d4 Require CMake 3.5 or newer.
The recent versions of CMake started to warn about compatibility with
older CMake versions than 3.5.
2024-01-08 18:19:26 +01:00
Martin Mitas
28f253d75c Fix some gcc warnings with -pedantic.
Fixes #187.
2024-01-08 18:18:51 +01:00
Martin Mitas
8c5e19063a Fix windows-32 build. 2023-12-12 19:56:56 +01:00
Martin Mitas
a9b0b4576a Migrate CI from Travis and Appveyor to Github Workflows. 2023-12-12 19:46:14 +01:00
Martin Mitas
a27f8dc093 test/fuzzers.fuzz-mdhtml.c: Remove stale comment. 2023-12-12 19:31:30 +01:00
Martin Mitas
e9ff661ff8 CHANGELOG.md: Link OSS-Fuzz. 2022-01-14 17:34:01 +01:00
Martin Mitas
7d439d49f0 CHANGELOG.md: Fix a typo. 2022-01-14 17:32:27 +01:00
Martin Mitas
d3c1c0bb2d fuzz-mdhtml.c: Cleanup of the code. 2022-01-14 17:27:05 +01:00
Martin Mitas
f7c8db7588 md_rollback: Fix dummization of virtual closers.
Fixes #173.
2022-01-14 11:04:02 +01:00
Martin Mitas
6abb7789f6 Remove debug messages left by mistake in the previous commit. 2022-01-14 10:13:28 +01:00
Martin Mitas
62b60979f6 Reset TABLECELLBOUNDARIES with ordinary opener chains.
This is needed because special handling of '|' is now done also if the
wiki-links extension is enabled so the chain is populated even with that
extension.

Fixes #174.
2022-01-14 10:12:30 +01:00
Martin Mitas
a470fbf8c3 md2html: Change interpretation of --github and --commonmark options.
Previously these assigned a set of parser flags with an operator '='.
Now '|=' is used so that any preceding options affecting what extensions
to allow are not ignored.
2022-01-13 20:34:47 +01:00
Martin Mitas
db9ab417b1 Improve wiki-link parsing.
* md_rollback: Restore dummy marks changed to virtual zero-length
   closers.

 * md_analyze_links: Be more careful in how we rollback contents
   of a full wiki link (`[[destination|label]]`). The destination has to
   be rollbacked completely (MD_ROLBACK_ALL) while the label only with
   MD_ROLLBACK_CROSSING.

Fixes #173.
2022-01-12 16:16:00 +01:00
Martin Mitas
8dd35762d9 md_analyze_dollar: Simplify the function. 2022-01-11 20:53:04 +01:00
Martin Mitas
4358c40ab7 md_lookup_line: Advance to the next line even if the offset...
falls into a gap between two lines, instead of returning NULL.
Fixes NULL dereference in md_is_link_reference(). This was a regression
in 2e9b13cc51.
2022-01-11 10:32:57 +01:00
Martin Mitas
c058e82c6a md_is_table_underline: Fix detection by the end of file.
This was a regression in a8bb4d3020.
2022-01-10 12:34:57 +01:00
Martin Mitas
b42e7f5cea md_resolve_links: Avoid link ref. def. lookup if...
if we know that the bracket pair contains nested brackets. That makes
the label invalid anyway, therefore we know that there is no link ref.
def. to be found anyway.

In case of heavily nested bracket pairs, the lookup could lead to
quadratic parsing times.

Fixes #172.
2022-01-10 11:41:25 +01:00
Martin Mitas
7f44e1ad6c pathological_tests.py: Improve code alignment. 2022-01-10 10:40:29 +01:00
Martin Mitas
2e9b13cc51 md_lookup_line: New function.
The function performs a binary search over array of MD_LINE structs to
find a line the given offset lives on.

Replaced few linear scans for such lines with a call to this function.
2022-01-10 03:16:47 +01:00
Martin Mitas
f662b26e16 Merge branch 'master' of https://github.com/mity/md4c 2022-01-06 16:27:06 +01:00
Tim Gates
cf5fe0c8c2
Fix a typo in a docs comment (#170)
Should read `propagated` rather than `propgated`.
2022-01-06 16:27:00 +01:00
Martin Mitas
b3593e7dd0 CHANGELOG.md: Update. 2022-01-06 16:25:20 +01:00
Thierry Coppey
f436c30298
Fix buffer overflows and other errors found with fuzzying. (#168)
Fix multiple buffer overflow on input found with fuzzying.
2022-01-06 16:21:51 +01:00
Martin Mitáš
eeb32ecc9e
Merge pull request #167 from dtldarek/master
Two buffer overflow fixes.
2022-01-06 16:16:45 +01:00
Martin Mitas
b8c31a5b81 CHANGELOG.md: Add a note for the PR #167. 2022-01-06 16:15:12 +01:00
Martin Mitas
a8bb4d3020 md_is_table_underline: Remove requirement for minimal length of a cell underline.
Fixes #169.
2022-01-06 16:01:55 +01:00
dtldarek
260cd3394d Fix buffer overflow on input found with fuzzying (in c-string format):
"\n# h1\nc  hh##e2ked\n\n A | rong__ ___strong \u0000\u0000\u0000\u0000\u0000\u0000\a\u0000\u0000\u0000\u0000\n# h1\nh# #2\n### h3\n#### h4\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\\\n##### h5\n#*#####\u0000\n6"
2021-08-25 15:02:38 +02:00
dtldarek
933388a657 This is a fix for a buffer overflow that happens on input found with fuzzying (in c-string format): "\xA9##r[](r[](". 2021-08-25 14:41:49 +02:00
Martin Mitas
ab422e83ff md4c-html.h: Fix typo in a comment. 2021-07-15 19:12:49 +02:00
Martin Mitas
7f0533068b CHANGELOG.md: Update. 2021-07-15 19:06:06 +02:00