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.
This commit is contained in:
Victor Stinner 2025-09-15 15:23:11 +01:00 committed by GitHub
parent f07ae274b8
commit 7c6efc3a4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3861,6 +3861,9 @@ byteswriter_create(Py_ssize_t size, int use_bytearray)
return NULL;
}
}
#ifdef Py_DEBUG
memset(writer->small_buffer, 0xff, sizeof(writer->small_buffer));
#endif
writer->obj = NULL;
writer->size = 0;
writer->use_bytearray = use_bytearray;