[cmucl-commit] [git] CMU Common Lisp branch master updated. snapshot-2012-12-8-g3be4fc2
Raymond Toy
rtoy at common-lisp.net
Sat Dec 22 20:46:58 UTC 2012
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMU Common Lisp".
The branch, master has been updated
via 3be4fc215fa2a4d23dc145e6cfa9519492525bc1 (commit)
from cdf11377fbdb369d3a3810dd9bd01a8a73007255 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3be4fc215fa2a4d23dc145e6cfa9519492525bc1
Author: Raymond Toy <toy.raymond at gmail.com>
Date: Sat Dec 22 12:46:45 2012 -0800
Fix ticket:67
Check that the start and end indices make sense for the given
strings. This is important before we start bashing random parts of
the string, potentially overwriting other objects.
diff --git a/src/compiler/generic/vm-tran.lisp b/src/compiler/generic/vm-tran.lisp
index 3376163..a90c87f 100644
--- a/src/compiler/generic/vm-tran.lisp
+++ b/src/compiler/generic/vm-tran.lisp
@@ -240,22 +240,34 @@
(deftransform replace ((string1 string2 &key (start1 0) (start2 0)
end1 end2)
(simple-string simple-string &rest t))
- '(locally (declare (optimize (safety 0)))
- (bit-bash-copy string2
- (the vm::offset
- (+ (the vm::offset (* start2 vm:char-bits))
- vector-data-bit-offset))
- string1
- (the vm::offset
- (+ (the vm::offset (* start1 vm:char-bits))
- vector-data-bit-offset))
- (the vm::offset
- (* (min (the vm::offset (- (or end1 (length string1))
- start1))
- (the vm::offset (- (or end2 (length string2))
- start2)))
- vm:char-bits)))
- string1))
+ '(progn
+ ;; Make sure the indices make sense before we go bashing bits
+ ;; around!
+ (assert (<= 0 start1))
+ (assert (<= start1 (or end1 (length string1))))
+ (assert (<= (or end1 (length string1)) (length string1)))
+
+ (assert (<= 0 start2))
+ (assert (<= start2 (or end2 (length string2))))
+ (assert (<= (or end2 (length string2)) (length string2)))
+
+ (locally
+ (declare (optimize (safety 0)))
+ (bit-bash-copy string2
+ (the vm::offset
+ (+ (the vm::offset (* start2 vm:char-bits))
+ vector-data-bit-offset))
+ string1
+ (the vm::offset
+ (+ (the vm::offset (* start1 vm:char-bits))
+ vector-data-bit-offset))
+ (the vm::offset
+ (* (min (the vm::offset (- (or end1 (length string1))
+ start1))
+ (the vm::offset (- (or end2 (length string2))
+ start2)))
+ vm:char-bits)))
+ string1)))
;; The original version of this deftransform seemed to cause the
;; compiler to spend huge amounts of time deriving the type of the
-----------------------------------------------------------------------
Summary of changes:
src/compiler/generic/vm-tran.lisp | 44 +++++++++++++++++++++++-------------
1 files changed, 28 insertions(+), 16 deletions(-)
hooks/post-receive
--
CMU Common Lisp
More information about the cmucl-commit
mailing list