Commit fdc1bd30 authored by Thomas Heller's avatar Thomas Heller

Fix for Bug #216405:

use the correct base for a buffer object in _PyBuffer_FromObject.
parent cad8fa15
...@@ -73,11 +73,13 @@ _PyBuffer_FromObject(PyObject *base, int offset, int size, ...@@ -73,11 +73,13 @@ _PyBuffer_FromObject(PyObject *base, int offset, int size,
offset = count; offset = count;
if ( offset + size > count ) if ( offset + size > count )
size = count - offset; size = count - offset;
/* if the base object is another buffer, then "deref" it */ /* if the base object is another buffer, then "deref" it,
if ( PyBuffer_Check(base) ) * except if the base of the other buffer is NULL
*/
if ( PyBuffer_Check(base) && (((PyBufferObject *)base)->b_base) )
base = ((PyBufferObject *)base)->b_base; base = ((PyBufferObject *)base)->b_base;
return _PyBuffer_FromMemory(base, (char *)p + offset, size, readonly); return _PyBuffer_FromMemory(base, (char *)p + offset, size, readonly);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment