mirror of
https://github.com/Orc/discount.git
synced 2026-09-25 04:10:00 +03:00
add code to do maximum recursion depth, and default it to 200
This commit is contained in:
+7
-1
@@ -1434,9 +1434,14 @@ compile(Line *ptr, int toplevel, MMIOT *f)
|
||||
|
||||
ptr = consume(ptr, ¶);
|
||||
|
||||
++(f->recursion);
|
||||
while ( ptr ) {
|
||||
|
||||
if ( iscode(ptr) ) {
|
||||
if ( f->recursion > MAX_RECURSION ) {
|
||||
p = Pp(&d, ptr, MARKUP);
|
||||
ptr = textblock(p, toplevel, &(f->flags) );
|
||||
}
|
||||
else if ( iscode(ptr) ) {
|
||||
p = Pp(&d, ptr, CODE);
|
||||
|
||||
if ( is_flag_set(&(f->flags), MKD_1_COMPAT) ) {
|
||||
@@ -1530,6 +1535,7 @@ compile(Line *ptr, int toplevel, MMIOT *f)
|
||||
p->align = PARA;
|
||||
|
||||
}
|
||||
(f->recursion)--;
|
||||
return T(d);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user