summaryrefslogtreecommitdiff
path: root/external/python3
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-01-06 15:22:17 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-01-06 15:22:17 +0100
commit2d66de44ea456e5525ee5515c4bef1421a26c0b9 (patch)
treeb1c887c4ef20bed97963f5a674267cbad8f4661e /external/python3
parent86b436d797081f63036a0db91802bc74aa0501aa (diff)
external/python3: Work around -fsanitize=bounds
Change-Id: I608ec429696e6a02aa528b10057d93da63544eb4
Diffstat (limited to 'external/python3')
-rw-r--r--external/python3/UnpackedTarball_python3.mk1
-rw-r--r--external/python3/ubsan.patch.022
2 files changed, 23 insertions, 0 deletions
diff --git a/external/python3/UnpackedTarball_python3.mk b/external/python3/UnpackedTarball_python3.mk
index 72d856fd80a3..8c5b1b71c808 100644
--- a/external/python3/UnpackedTarball_python3.mk
+++ b/external/python3/UnpackedTarball_python3.mk
@@ -33,6 +33,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,python3,\
external/python3/python-3.3.5-vs2013.patch.1 \
external/python3/python-msvc-disable-sse2.patch.1 \
external/python3/python-lsan.patch.0 \
+ external/python3/ubsan.patch.0 \
))
ifneq ($(filter DRAGONFLY FREEBSD LINUX NETBSD OPENBSD SOLARIS,$(OS)),)
diff --git a/external/python3/ubsan.patch.0 b/external/python3/ubsan.patch.0
new file mode 100644
index 000000000000..acfd1896a104
--- /dev/null
+++ b/external/python3/ubsan.patch.0
@@ -0,0 +1,22 @@
+--- Objects/listobject.c
++++ Objects/listobject.c
+@@ -2036,7 +2036,7 @@
+ if (keys != NULL) {
+ for (i = 0; i < saved_ob_size; i++)
+ Py_DECREF(keys[i]);
+- if (keys != &ms.temparray[saved_ob_size+1])
++ if (keys != ((char *) ms.temparray) + (saved_ob_size+1) * sizeof (PyObject *))
+ PyMem_FREE(keys);
+ }
+
+--- Objects/longobject.c
++++ Objects/longobject.c
+@@ -36,7 +36,7 @@
+ static PyObject *
+ get_small_int(sdigit ival)
+ {
+- PyObject *v = (PyObject*)(small_ints + ival + NSMALLNEGINTS);
++ PyObject *v = (PyObject*)(small_ints + (ival + NSMALLNEGINTS));
+ Py_INCREF(v);
+ #ifdef COUNT_ALLOCS
+ if (ival >= 0)