This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 455024 - python: Small python bz2 library interface and file object implementation fixes
python: Small python bz2 library interface and file object implementation fixes
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: python (Show other bugs)
5.3
All Linux
low Severity low
: rc
: ---
Assigned To: Dave Malcolm
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-07-11 10:47 EDT by Jan Lieskovsky
Modified: 2013-03-14 17:36 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-03-14 17:36:10 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jan Lieskovsky 2008-07-11 10:47:39 EDT
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 Product and Program Management 2013-03-14 17:36:10 EDT
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.