summaryrefslogtreecommitdiffstats
path: root/Objects/bytesobject.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2007-08-19 04:23:20 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2007-08-19 04:23:20 (GMT)
commitfaa54a392951468090f0095ffa927b16fcb20ca4 (patch)
treea8586a5cc833217e6b1eaf4d052313475534178a /Objects/bytesobject.c
parent1836358c016cd7f5117f4f34fa3a27c5701e8265 (diff)
downloadcpython-faa54a392951468090f0095ffa927b16fcb20ca4.zip
cpython-faa54a392951468090f0095ffa927b16fcb20ca4.tar.gz
cpython-faa54a392951468090f0095ffa927b16fcb20ca4.tar.bz2
Code review of the new buffer protocol. Mostly add questions that should
be answered with the comments removed. There are many places that require checks when doing arithmetic for memory sizes when allocating memory. Otherwise, overflow is possible with a subsequent crash. Fix SF #1777057 which was a result of not initializing the new BufferError properly. Had to update the test for exceptions for BufferError too.
Diffstat (limited to 'Objects/bytesobject.c')
-rw-r--r--Objects/bytesobject.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index 5a03beb..0ada1e7 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -507,6 +507,7 @@ bytes_setslice(PyBytesObject *self, Py_ssize_t lo, Py_ssize_t hi,
memmove(self->ob_bytes + lo + needed, self->ob_bytes + hi,
Py_Size(self) - hi);
}
+ /* XXX(nnorwitz): need to verify this can't overflow! */
if (PyBytes_Resize((PyObject *)self,
Py_Size(self) + needed - avail) < 0) {
res = -1;