Author: Tim Felgentreff <[email protected]>
Branch: 
Changeset: r268:b8b65d5a85bb
Date: 2013-04-15 11:05 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/b8b65d5a85bb/

Log:    fail STRING_REPLACE primitive for out-of-bounds access to pointer
        objects, fallback to in-image code

diff --git a/spyvm/model.py b/spyvm/model.py
--- a/spyvm/model.py
+++ b/spyvm/model.py
@@ -36,6 +36,11 @@
         space, as memory representation varies depending on PyPy 
translation."""
         return 0
 
+    def instsize(self, space):
+        """Return the size of the object reserved for instance variables.
+        Only returns something non-zero for W_PointersObjects"""
+        return 0
+
     def varsize(self, space):
         """Return bytesize of variable-sized part.
 
diff --git a/spyvm/primitives.py b/spyvm/primitives.py
--- a/spyvm/primitives.py
+++ b/spyvm/primitives.py
@@ -655,8 +655,8 @@
     # might be different (e.g. Symbol and ByteString)
     if w_rcvr.__class__ is not w_replacement.__class__:
         raise PrimitiveFailedError()
-    if (w_rcvr.size() <= stop
-            or w_replacement.size() < repStart + (stop - start)):
+    if (w_rcvr.size() - w_rcvr.instsize(interp.space) <= stop
+            or w_replacement.size() - w_replacement.instsize(interp.space) < 
repStart + (stop - start)):
         raise PrimitiveFailedError()
     repOff = repStart - start
     for i0 in range(start, stop + 1):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to