Skip to content

Commit

Permalink
Bug fix: guard against left recursion in DTDs.
Browse files Browse the repository at this point in the history
  • Loading branch information
svenemtell committed May 24, 2020
1 parent adb4430 commit f82a96a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions xml/xml-parse.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -2224,6 +2224,8 @@
(t nil))))
#'doit)))

(defvar *left-recursion* nil)

(defun compile-content-model (cspec &optional (continuation #'cmodel-done))
(if (vectorp cspec)
(lambda (actual-name)
Expand Down Expand Up @@ -2251,9 +2253,11 @@
(*
(let (maybe-continuation)
(labels ((recurse (actual-name)
(if (null actual-name)
(if (or (null actual-name)
*left-recursion*)
(funcall continuation actual-name)
(or (funcall maybe-continuation actual-name)
(or (let ((*left-recursion* t))
(funcall maybe-continuation actual-name))
(funcall continuation actual-name)))))
(setf maybe-continuation
(compile-content-model (second cspec) #'recurse))
Expand Down

0 comments on commit f82a96a

Please sign in to comment.