diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2015-01-23 21:19:53 +0000 |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2015-01-23 21:19:53 +0000 |
commit | 25e326da3d6019e27a1313adcfd04f40fe8e7f77 (patch) | |
tree | 101f889280999cff5b2cba58721a93d204e6e689 /Python/thread_pthread.h | |
parent | 602523212f6e8c403c43001bbee92623602ecce1 (diff) | |
parent | 8dd2d03028fc496557f4ab52e6fa36c119773236 (diff) | |
download | cpython-25e326da3d6019e27a1313adcfd04f40fe8e7f77.tar.gz |
Closes #23305: Merged documentation fix from 3.4.
Diffstat (limited to 'Python/thread_pthread.h')
-rw-r--r-- | Python/thread_pthread.h | 10 |
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 |