diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-10-06 21:11:25 -0400 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-10-06 21:11:25 -0400 |
commit | 9c06648ea3157945a37a3b38e35d71c948b998dd (patch) | |
tree | 6bc2c56520ecad5d30a8b5bbfcc2c05191cfc43f /Python/thread_pthread.h | |
parent | 1c41575d9be1e2bcce4916ed170fceacf456dd65 (diff) | |
parent | 9d2ec0c84470eb9fdec4fe87cb223a425370e6c3 (diff) | |
download | cpython-9c06648ea3157945a37a3b38e35d71c948b998dd.tar.gz |
merge 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 |