summaryrefslogtreecommitdiff
path: root/Python/thread_pthread.h
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-01-22 09:09:24 +0100
committerVictor Stinner <victor.stinner@gmail.com>2015-01-22 09:09:24 +0100
commit3fd279ebe09bbd98f93b1a74e44bf69b05f28b14 (patch)
treea29b724be9b4d73eaf040c1da3f06eb30440304c /Python/thread_pthread.h
parentf21948c9b62b6c4e31a5d10f4c4eddd8cb3e2331 (diff)
parent7d98c6e7cca7c964ce01afdf88125b147b57943f (diff)
downloadcpython-3fd279ebe09bbd98f93b1a74e44bf69b05f28b14.tar.gz
Merge 3.4
Diffstat (limited to 'Python/thread_pthread.h')
-rw-r--r--Python/thread_pthread.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h
index d9f7c76f2a..27e0dc84bc 100644
--- a/Python/thread_pthread.h
+++ b/Python/thread_pthread.h
@@ -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