From caa61bb817bad8b31771be6f19fb4cb787d78042 Mon Sep 17 00:00:00 2001 From: David Lichteblau Date: Mon, 20 Sep 2010 00:07:37 +0200 Subject: [PATCH] Patches by Slava Gorbunov --- src/parse/html-parser.lisp | 8 ++++---- src/parse/sgml-parse.lisp | 11 ++++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/parse/html-parser.lisp b/src/parse/html-parser.lisp index 1160293..ea72962 100644 --- a/src/parse/html-parser.lisp +++ b/src/parse/html-parser.lisp @@ -33,10 +33,10 @@ (defparameter sgml::*simple-catalog* (let ((base - (merge-pathnames - "resources/" - (asdf:component-relative-pathname - (asdf:find-system :closure-html))))) + (merge-pathnames + (make-pathname :directory '(:relative "resources") :type :unspecific) + (asdf:component-relative-pathname + (asdf:find-system :closure-html))))) (loop :for (name . filename) :in '(("-//W3O//DTD W3 HTML 3.0//EN" . "dtd/HTML-3.0") diff --git a/src/parse/sgml-parse.lisp b/src/parse/sgml-parse.lisp index b51beb1..faa9029 100644 --- a/src/parse/sgml-parse.lisp +++ b/src/parse/sgml-parse.lisp @@ -361,7 +361,10 @@ (a-unread-byte ch input) (return)) ((rune= ch #/&) - (setf sp (read-entity-ref input dtd sp))) + (setf sp (read-entity-ref input dtd sp)) + (if (>= sp se) ;read-entity-ref may enlarge scratchpad + (setf scratch (a-stream-scratch input) + se (length scratch)))) (t (setf (aref scratch sp) ch) ;recode character read (setf sp (the fixnum (+ sp 1))) @@ -544,7 +547,9 @@ (defun read-start-tag (input dtd) (multiple-value-bind (name atts) (read-name-and-attributes input dtd) (let ((ch (a-read-byte input))) - (cond ((rune= ch #/>) + (cond ((null ch) + (read-tag-error input "EOF inside tag")) + ((rune= ch #/>) (values :start-tag name atts)) ((rune= ch #/<) (parse-warn input 3 @@ -576,7 +581,7 @@ (atts nil)) (loop (skip-white-space input) - (cond ((member (a-peek-byte input) '(#/< #/> #//) :test #'rune=) + (cond ((member (a-peek-byte input) '(#/< #/> #//) :test #'eql) (return))) (push (read-attribute input dtd) atts)) (values name (nreverse atts)) )) -- 2.11.4.GIT