diff options
author | Martin Panter <vadmium+py@gmail.com> | 2015-10-07 10:01:04 +0000 |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2015-10-07 10:01:04 +0000 |
commit | 6e1d0fd29a658fa402340dbc031e4fc7db202ee7 (patch) | |
tree | 43991206a47c92f8b2ac1d4a1a938f31e5294f08 /Python/thread_pthread.h | |
parent | ffee692e0ddd36e128c7dc3632b1e795a9a8a289 (diff) | |
parent | 51dc66135fd222c634512dfacba7a799372d230f (diff) | |
download | cpython-6e1d0fd29a658fa402340dbc031e4fc7db202ee7.tar.gz |
Issue #25286: Merge dictionary view glossary from 3.4 into 3.5
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 |