Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7270b7f commit daca3d7Copy full SHA for daca3d7
2 files changed
Misc/NEWS
@@ -10,6 +10,9 @@ Release date: TBA
10
Core and Builtins
11
-----------------
12
13
+- Issue #22206: Using pthread, PyThread_create_key() now sets errno to ENOMEM
14
+ and returns -1 (error) on integer overflow.
15
+
16
- Issue #20184: Argument Clinic based signature introspection added for
17
30 of the builtin functions.
18
Python/thread_pthread.h
@@ -608,7 +608,15 @@ PyThread_create_key(void)
608
{
609
pthread_key_t key;
610
int fail = pthread_key_create(&key, NULL);
611
- return fail ? -1 : key;
+ if (fail)
612
+ return -1;
613
+ if (key > INT_MAX) {
614
+ /* Issue #22206: handle integer overflow */
615
+ pthread_key_delete(key);
616
+ errno = ENOMEM;
617
618
+ }
619
+ return (int)key;
620
}
621
622
void
0 commit comments