From 9daadaf32675c2e88b814783ffce827c5ea527af Mon Sep 17 00:00:00 2001 From: ram <ram> Date: Thu, 22 Jul 1993 00:02:08 +0000 Subject: [PATCH] Tweaked source-path-context to check if the source path in in bounds for the form so that we don't get bus errors, etc., if the file has been modified. --- code/debug-int.lisp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/code/debug-int.lisp b/code/debug-int.lisp index 03da38fd4..ef1696961 100644 --- a/code/debug-int.lisp +++ b/code/debug-int.lisp @@ -7,7 +7,7 @@ ;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/debug-int.lisp,v 1.59 1993/05/28 05:20:44 wlott Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/debug-int.lisp,v 1.60 1993/07/22 00:02:08 ram Exp $") ;;; ;;; ********************************************************************** ;;; @@ -3042,8 +3042,11 @@ ;; context and path. (let ((path (reverse (butlast (cdr path))))) (dotimes (i (- (length path) context)) - (setq form (elt form (first path))) - (setq path (rest path))) + (let ((index (first path))) + (unless (and (listp form) (< index (length form))) + (error "Source path no longer exists.")) + (setq form (elt form index)) + (setq path (rest path)))) ;; ;; Recursively rebuild the source form resulting from the above descent, ;; copying the beginning of each subform up to the next subform we descend @@ -3055,10 +3058,12 @@ (if (zerop context) form `(#:***here*** ,form)) - (let* ((n (first path)) - (res (frob (elt form n) (rest path) (1- level)))) - (nconc (subseq form 0 n) - (cons res (nthcdr (1+ n) form))))))) + (let ((n (first path))) + (unless (and (listp form) (< n (length form))) + (error "Source path no longer exists.")) + (let ((res (frob (elt form n) (rest path) (1- level)))) + (nconc (subseq form 0 n) + (cons res (nthcdr (1+ n) form)))))))) (frob form path context)))) -- GitLab