- Stop python bailing out with an assertion failure when

UnicodeDecodeErrors occur on very large buffers (patch 120, upstream
    issue 9058)
This commit is contained in:
dmalcolm 2010-06-22 18:40:57 +00:00
parent 908bb70bf7
commit 468e2badf2
2 changed files with 36 additions and 1 deletions

View File

@ -0,0 +1,25 @@
Index: Objects/exceptions.c
===================================================================
--- Objects/exceptions.c (revision 82153)
+++ Objects/exceptions.c (working copy)
@@ -1784,11 +1784,15 @@
const char *encoding, const char *object, Py_ssize_t length,
Py_ssize_t start, Py_ssize_t end, const char *reason)
{
- assert(length < INT_MAX);
- assert(start < INT_MAX);
- assert(end < INT_MAX);
- return PyObject_CallFunction(PyExc_UnicodeDecodeError, "ss#nns",
- encoding, object, length, start, end, reason);
+ PyObject *str;
+
+ str = PyString_FromStringAndSize(object, length);
+
+ if (!str)
+ return NULL;
+
+ return PyObject_CallFunction(PyExc_UnicodeDecodeError, "sNnns",
+ encoding, str, start, end, reason);
}

View File

@ -63,7 +63,7 @@ Summary: An interpreted, interactive, object-oriented programming language
Name: %{python}
# Remember to also rebase python-docs when changing this:
Version: 2.6.5
Release: 16%{?dist}
Release: 17%{?dist}
License: Python
Group: Development/Languages
Provides: python-abi = %{pybasever}
@ -401,6 +401,11 @@ Patch118: python-2.6.2-CVE-2008-5983.patch
# Sent upstream as http://bugs.python.org/issue9054
Patch119: python-2.6.5-fix-expat-issue9054.patch
# Stop python bailing out with an assertion failure when UnicodeDecodeErrors
# occur on very large buffers (rhbz:540518)
# Sent upstream as http://bugs.python.org/issue9058
Patch120: python-2.6.5-remove-PyUnicodeDecodeError_Create-assertions-issue9058.patch
%if %{main_python}
Obsoletes: Distutils
Provides: Distutils
@ -640,6 +645,7 @@ rm -r Modules/zlib || exit 1
%patch117 -p1 -b .CVE-2010-2089
%patch118 -p1 -b .CVE-2008-5983
%patch119 -p0 -b .fix-expat-issue9054
%patch120 -p0 -b .remove-unicode-decode-error-assertions-issue9058
# This shouldn't be necesarry, but is right now (2.2a3)
find -name "*~" |xargs rm -f
@ -1364,6 +1370,10 @@ rm -fr %{buildroot}
# payload file would be unpackaged)
%changelog
* Tue Jun 22 2010 David Malcolm <dmalcolm@redhat.com> - 2.6.5-17
- Stop python bailing out with an assertion failure when UnicodeDecodeErrors
occur on very large buffers (patch 120, upstream issue 9058)
* Mon Jun 21 2010 David Malcolm <dmalcolm@redhat.com> - 2.6.5-16
- Fix an incompatibility between pyexpat and the system expat-2.0.1 that led to
a segfault running test_pyexpat.py (patch 119; upstream issue 9054)