mirror of
https://github.com/python/cpython.git
synced 2026-06-05 17:31:21 +00:00
gh-149009: Validate thread_count in profiling.sampling binary reader (#149147)
This commit is contained in:
parent
04ce318522
commit
c266f0c375
3 changed files with 41 additions and 0 deletions
|
|
@ -559,6 +559,14 @@ reader_get_or_create_thread_state(BinaryReader *reader, uint64_t thread_id,
|
|||
}
|
||||
}
|
||||
|
||||
if (reader->thread_state_count >= reader->thread_count) {
|
||||
PyErr_Format(PyExc_ValueError,
|
||||
"Invalid thread count: sample data contains more unique threads than declared in header "
|
||||
"(declared %u, found at least %zu)",
|
||||
reader->thread_count, reader->thread_state_count + 1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!reader->thread_states) {
|
||||
reader->thread_state_capacity = 16;
|
||||
reader->thread_states = PyMem_Calloc(reader->thread_state_capacity, sizeof(ReaderThreadState));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue