diff options
author | Benjamin Peterson <benjamin@python.org> | 2015-10-06 19:42:02 -0700 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2015-10-06 19:42:02 -0700 |
commit | c16b8b405e790c04e4062a4b1231ba56387e4273 (patch) | |
tree | 7e6120af47d7413550634e652c8e827603c5c615 /Python/thread_pthread.h | |
parent | 07929c5f6dd69c554889910bf5988ad6c31f5593 (diff) | |
parent | 65e767b0df52dd8262d49f3c1ea1ae3567bb4d47 (diff) | |
download | cpython-c16b8b405e790c04e4062a4b1231ba56387e4273.tar.gz |
merge 3.4 (#24806)
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 |