[pypy-commit] pypy py3.6: CPython Issue #29444: Add array bound check in group(), because the underlying
amauryfa
pypy.commits at gmail.com
Mon Dec 18 03:37:54 EST 2017
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3.6
Changeset: r93458:dda99c39353f
Date: 2017-12-17 18:57 +0100
http://bitbucket.org/pypy/pypy/changeset/dda99c39353f/
Log: CPython Issue #29444: Add array bound check in group(), because the
underlying buffer is mutable. Difficult to test in non-translated
code...
diff --git a/pypy/module/_sre/interp_sre.py b/pypy/module/_sre/interp_sre.py
--- a/pypy/module/_sre/interp_sre.py
+++ b/pypy/module/_sre/interp_sre.py
@@ -36,6 +36,9 @@
def slice_w(space, ctx, start, end, w_default):
if 0 <= start <= end:
if isinstance(ctx, rsre_core.BufMatchContext):
+ length = ctx._buffer.getlength()
+ start = min(start, length)
+ end = min(end, length)
return space.newbytes(ctx._buffer.getslice(start, end, 1,
end-start))
if isinstance(ctx, rsre_core.StrMatchContext):
More information about the pypy-commit
mailing list