diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-12 14:35:46 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-12 14:35:46 +0200 |
commit | b51bd875193c84e51afb907a0c8ff6091fc95d5f (patch) | |
tree | d2e3c85d92f1ae680f0c90b4b4fc88cce58ecba0 /Python/thread_pthread.h | |
parent | e7ed9c7bd2204dd48d67eb7b14813c0338a85a0c (diff) | |
parent | f246749b9aa9cdb1f05eca29b7eef6a04e05fc8b (diff) | |
download | cpython-b51bd875193c84e51afb907a0c8ff6091fc95d5f.tar.gz |
Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X
when decode astral characters.
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 |