Skip to content

Commit 7c6efc3

Browse files
authored
gh-129813, PEP 782: Init small_buffer in PyBytesWriter_Create() (#138924)
Fill small_buffer with 0xFF byte pattern to detect the usage of uninitialized bytes in debug build.
1 parent f07ae27 commit 7c6efc3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Objects/bytesobject.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3861,6 +3861,9 @@ byteswriter_create(Py_ssize_t size, int use_bytearray)
38613861
return NULL;
38623862
}
38633863
}
3864+
#ifdef Py_DEBUG
3865+
memset(writer->small_buffer, 0xff, sizeof(writer->small_buffer));
3866+
#endif
38643867
writer->obj = NULL;
38653868
writer->size = 0;
38663869
writer->use_bytearray = use_bytearray;

0 commit comments

Comments
 (0)