[cxml-devel] Possible bug in rune-dom::adjust-vector-exponentially

Camille Troillard camille at osculator.net
Wed Dec 5 15:46:29 UTC 2012


Hi,

I have a process that is stuck in the following function:

;; from dom-impl.lisp
(defun adjust-vector-exponentially (vector new-dimension set-fill-pointer-p)
  (let ((d (array-dimension vector 0)))
    (when (< d new-dimension)
      (loop
	  do (setf d (* 2 d))
	  while (< d new-dimension))
      (adjust-array vector d))
    (when set-fill-pointer-p
      (setf (fill-pointer vector) new-dimension))))


Apparently, adjust-vector-exponentially assumes d > 0, but this function has been called from (METHOD SAX:CHARACTERS (RUNE-DOM::DOM-BUILDER T)) with an empty string (d = 0).  The loop obviously shows it will never exit the function.

Adding the following before the loop statement fixes the problem:

      (when (= d 0)
        (incf d))


Best Regards,
Camille





More information about the cxml-devel mailing list