From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]); by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id deee94bf; for ; Mon, 22 Dec 2014 18:28:03 -0500 (EST) Date: Mon, 22 Dec 2014 18:28:03 -0500 (EST) Message-Id: <13993754461203555234.enqueue@fantadrom.bsd.lv> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: The code already pays attention not to close the same block X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- The code already pays attention not to close the same block twice. Similarly, avoid having the same block break two other blocks. In some situations, this could lead to an endless loop in rew_sub() found by jsg@ with afl. Minimal example: .Po Ao Pc Bo Pc Ac Bc Modified Files: -------------- mdocml: mdoc_macro.c Revision Data ------------- Index: mdoc_macro.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/mdoc_macro.c,v retrieving revision 1.160 retrieving revision 1.161 diff -Lmdoc_macro.c -Lmdoc_macro.c -u -p -r1.160 -r1.161 --- mdoc_macro.c +++ mdoc_macro.c @@ -363,7 +363,7 @@ rew_dohalt(enum mdoct tok, enum mdoc_typ * When starting to rewind, skip plain text * and nodes that have already been rewound. */ - if (MDOC_TEXT == p->type || MDOC_VALID & p->flags) + if (p->type == MDOC_TEXT || p->flags & (MDOC_VALID | MDOC_BREAK)) return(REWIND_MORE); /* @@ -746,7 +746,7 @@ blk_exp_close(MACRO_PROT_ARGS) atok = rew_alt(tok); body = endbody = later = NULL; for (n = mdoc->last; n; n = n->parent) { - if (n->flags & MDOC_VALID) + if (n->flags & (MDOC_VALID | MDOC_BREAK)) continue; /* Remember the start of our own body. */ -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv