diff options
author | Lars Gust?bel <lars@gustaebel.de> | 2015-07-02 19:41:03 +0200 |
---|---|---|
committer | Lars Gust?bel <lars@gustaebel.de> | 2015-07-02 19:41:03 +0200 |
commit | a0333aa657baeb3738a8c2fe211168cb1dbab8ac (patch) | |
tree | 9d48b355036c218e706d4e0c698fc3586673bd5b /Python/thread_pthread.h | |
parent | e8c3a8aa583475fa33dd8b74959193217cb56933 (diff) | |
parent | c6050850b5f399a24702795515d02fdf06b01b4f (diff) | |
download | cpython-a0333aa657baeb3738a8c2fe211168cb1dbab8ac.tar.gz |
Merge with 3.4: Issue #24514: tarfile now tolerates number fields consisting of only whitespace.
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 |