md_build_img_alt: Fix crash when dealing with some mark types. For some mark types, it is possible that subsequent mark has lower 'beg' then 'end' of the previous one. This typically happens when an opener mark is expanded to cover whole range to the closer.
diff --git a/md4c/md4c.c b/md4c/md4c.c
index 07e415d..81c438e 100644
--- a/md4c/md4c.c
+++ b/md4c/md4c.c
@@ -3288,7 +3288,7 @@ md_build_img_alt(MD_CTX* ctx, MD_MARK* mark, const MD_LINE* lines, int n_lines,
off = mark->end;
mark++;
- while(!(mark->flags & MD_MARK_RESOLVED))
+ while(!(mark->flags & MD_MARK_RESOLVED) || mark->beg < off)
mark++;
}
}