Bug 455024 - python: Small python bz2 library interface and file object implementation fixes
Summary: python: Small python bz2 library interface and file object implementation fixes
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: python
Version: 5.3
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Dave Malcolm
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-07-11 14:47 UTC by Jan Lieskovsky
Modified: 2013-03-14 21:36 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-03-14 21:36:10 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jan Lieskovsky 2008-07-11 14:47:39 UTC
Description of problem:

David Remahl discovered the following two bugs in the python bz2 library
interface and file object implementation

Proposed patch:

Index: Modules/bz2module.c
===================================================================
--- Modules/bz2module.c (revision 64642)
+++ Modules/bz2module.c (working copy)
@@ -525,7 +525,7 @@
                buffersize = Util_NewBufferSize((size_t)0);
        else
                buffersize = bytesrequested;
-       if (buffersize > INT_MAX) {
+       if (buffersize > PY_SSIZE_T_MAX) {
                PyErr_SetString(PyExc_OverflowError,
                                "requested number of bytes is "
                                "more than a Python string can hold");
Index: Objects/fileobject.c
===================================================================
--- Objects/fileobject.c        (revision 64642)
+++ Objects/fileobject.c        (working copy)
@@ -831,7 +831,6 @@
        long bytesrequested = -1;
        size_t bytesread, buffersize, chunksize;
        PyObject *v;
-
        if (f->f_fp == NULL)
                return err_closed();
        /* refuse to mix with f.next() */
@@ -845,6 +844,7 @@
                buffersize = new_buffersize(f, (size_t)0);
        else
                buffersize = bytesrequested;
+
        if (buffersize > PY_SSIZE_T_MAX) {
                PyErr_SetString(PyExc_OverflowError,
        "requested number of bytes is more than a Python string can hold");
@@ -1075,7 +1075,7 @@
         * into its buffer.
         */
        total_v_size = MAXBUFSIZE << 1;
-       v = PyString_FromStringAndSize((char*)NULL, (int)total_v_size);
+       v = PyString_FromStringAndSize((char*)NULL, total_v_size);
        if (v == NULL)
                return v;
        /* copy over everything except the last null byte */
@@ -1130,7 +1130,7 @@
                        Py_DECREF(v);
                        return NULL;
                }
-               if (_PyString_Resize(&v, (int)total_v_size) < 0)
+               if (_PyString_Resize(&v, (Py_ssize_t)total_v_size) < 0)
                        return NULL;
                /* overwrite the trailing null byte */
                pvfree = BUF(v) + (prev_v_size - 1);

Comment 2 RHEL Program Management 2013-03-14 21:36:10 UTC
Development Management has reviewed and declined this request.
You may appeal this decision by reopening this request.


Note You need to log in before you can comment on or make changes to this bug.