author | Martin Mitas
<mity@morous.org> 2018-03-28 06:21:21 UTC |
committer | Martin Mitas
<mity@morous.org> 2018-03-28 06:21:21 UTC |
parent | e0002e2b52e0c6877d196a16488692b5dbfd7ac9 |
md4c/md4c.c | +3 | -2 |
test/coverage.txt | +10 | -0 |
diff --git a/md4c/md4c.c b/md4c/md4c.c index 52efc7a..0f3522e 100644 --- a/md4c/md4c.c +++ b/md4c/md4c.c @@ -1384,13 +1384,14 @@ md_build_attr_append_substr(MD_CTX* ctx, MD_ATTRIBUTE_BUILD* build, build->substr_alloc = (build->substr_alloc == 0 ? 8 : build->substr_alloc * 2); new_substr_types = (MD_TEXTTYPE*) realloc(build->substr_types, - (build->substr_alloc+1) * sizeof(MD_TEXTTYPE)); + build->substr_alloc * sizeof(MD_TEXTTYPE)); if(new_substr_types == NULL) { MD_LOG("realloc() failed."); return -1; } + /* Note +1 to reserve space for final offset (== raw_size). */ new_substr_offsets = (OFF*) realloc(build->substr_offsets, - build->substr_alloc * sizeof(OFF)); + (build->substr_alloc+1) * sizeof(OFF)); if(new_substr_offsets == NULL) { MD_LOG("realloc() failed."); free(new_substr_types); diff --git a/test/coverage.txt b/test/coverage.txt index 7a0ec5a..528069b 100644 --- a/test/coverage.txt +++ b/test/coverage.txt @@ -118,6 +118,16 @@ a*b**c* ```````````````````````````````` +### [Issue 33](https://github.com/mity/md4c/issues/33) +```````````````````````````````` example +```&&&&&&&& +. +<pre><code class="language-&&&&&&&&"></code></pre> + +```````````````````````````````` + + + ## Code coverage ### `md_is_unicode_whitespace__()`