Skip to content

Commit

Permalink
md_is_[hex|dec]_entity_contents: Fix maximal entity length.
Browse files Browse the repository at this point in the history
Spec. version 0.29 limits the decimal character length to at most
7 decimal digits and hexadecimal character length to at most 6
hexadecimal digits.

Fixes #77.
  • Loading branch information
mity committed May 16, 2019
1 parent aca5c27 commit 267e82d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
# MD4C Change Log


## Next Version (Work in Progress)

Fixes:
* [#77](https://github.com/mity/md4c/issues/77):
Fix maximal counts of digits for numerical character references, as requested
by CommonMark specification 0.29.


## Version 0.3.3

Changes:
Expand Down
4 changes: 2 additions & 2 deletions md4c/md4c.c
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ md_is_hex_entity_contents(MD_CTX* ctx, const CHAR* text, OFF beg, OFF max_end, O
while(off < max_end && ISXDIGIT_(text[off]) && off - beg <= 8)
off++;

if(1 <= off - beg && off - beg <= 8) {
if(1 <= off - beg && off - beg <= 6) {
*p_end = off;
return TRUE;
} else {
Expand All @@ -1240,7 +1240,7 @@ md_is_dec_entity_contents(MD_CTX* ctx, const CHAR* text, OFF beg, OFF max_end, O
while(off < max_end && ISDIGIT_(text[off]) && off - beg <= 8)
off++;

if(1 <= off - beg && off - beg <= 8) {
if(1 <= off - beg && off - beg <= 7) {
*p_end = off;
return TRUE;
} else {
Expand Down

0 comments on commit 267e82d

Please sign in to comment.