[pypy-commit] pypy stringbuilder2-perf: Add a few ll_asserts to check the range of arguments to copy_string_contents().
arigo
noreply at buildbot.pypy.org
Sun Jun 15 16:17:11 CEST 2014
Author: Armin Rigo <arigo at tunes.org>
Branch: stringbuilder2-perf
Changeset: r72062:12f9cd24a1b1
Date: 2014-06-15 16:14 +0200
http://bitbucket.org/pypy/pypy/changeset/12f9cd24a1b1/
Log: Add a few ll_asserts to check the range of arguments to
copy_string_contents().
diff --git a/rpython/rtyper/lltypesystem/rstr.py b/rpython/rtyper/lltypesystem/rstr.py
--- a/rpython/rtyper/lltypesystem/rstr.py
+++ b/rpython/rtyper/lltypesystem/rstr.py
@@ -77,6 +77,10 @@
# are obscurely essential to make sure that the strings stay alive
# longer than the raw_memcopy().
assert length >= 0
+ ll_assert(srcstart >= 0, "copystrc: negative srcstart")
+ ll_assert(srcstart + length <= len(src.chars), "copystrc: src ovf")
+ ll_assert(dststart >= 0, "copystrc: negative dststart")
+ ll_assert(dststart + length <= len(dst.chars), "copystrc: dst ovf")
# from here, no GC operations can happen
src = _get_raw_buf(SRC_TP, src, srcstart)
dst = _get_raw_buf(DST_TP, dst, dststart)
More information about the pypy-commit
mailing list