mirror of
https://github.com/python/cpython.git
synced 2025-09-04 16:01:10 +00:00
Issue #22206: Using pthread, PyThread_create_key() now sets errno to ENOMEM and
returns -1 (error) on integer overflow.
This commit is contained in:
parent
7270b7f1aa
commit
daca3d7e9b
2 changed files with 12 additions and 1 deletions
|
@ -608,7 +608,15 @@ PyThread_create_key(void)
|
|||
{
|
||||
pthread_key_t key;
|
||||
int fail = pthread_key_create(&key, NULL);
|
||||
return fail ? -1 : key;
|
||||
if (fail)
|
||||
return -1;
|
||||
if (key > INT_MAX) {
|
||||
/* Issue #22206: handle integer overflow */
|
||||
pthread_key_delete(key);
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
return (int)key;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue