mity / md4c

C Markdown parser. Fast. SAX-like interface. Compliant to CommonMark specification.
MIT License
755 stars 138 forks source link

Introduce an overall limit to link. ref. defs instantiations. #239

Closed mity closed 4 months ago

mity commented 4 months ago

This is to prevent time and output size explosion in case of input pattern generated by this:

$ python -c 'N=1000; print("[x]: " + "x" * N + "\n[x]" * N)'

We roughly allow to blowing up the input size of the document 16 times by link reference definitions or up to 1 MB, whatever is smaller. When the threshold is reached, following reference definitions are sent to output unresolved as a text.

Fixes #238.

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (6c29f60) 91.76% compared to head (b71ceef) 91.79%. Report is 2 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #239 +/- ## ========================================== + Coverage 91.76% 91.79% +0.02% ========================================== Files 5 5 Lines 3402 3412 +10 ========================================== + Hits 3122 3132 +10 Misses 280 280 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.