Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(348)

Unified Diff: Objects/bytearrayobject.c

Issue 24467: bytearray pop and remove Buffer Over-read
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_bytes.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Objects/bytearrayobject.c Sun Jun 28 11:15:13 2015 -0400
+++ b/Objects/bytearrayobject.c Sun Jun 28 22:26:20 2015 +0300
@@ -891,8 +891,10 @@ bytearray_init(PyByteArrayObject *self,
goto error;
/* Append the byte */
- if (Py_SIZE(self) < self->ob_alloc)
+ if (Py_SIZE(self) + 1 < self->ob_alloc) {
Py_SIZE(self)++;
+ PyByteArray_AS_STRING(self)[Py_SIZE(self)] = '\0';
+ }
else if (PyByteArray_Resize((PyObject *)self, Py_SIZE(self)+1) < 0)
goto error;
PyByteArray_AS_STRING(self)[Py_SIZE(self)-1] = value;
« no previous file with comments | « Lib/test/test_bytes.py ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+