diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2015-04-13 19:49:35 +0200 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2015-04-13 19:49:35 +0200 |
commit | 2cbda449d3593a3ccc302088fab64585f733069a (patch) | |
tree | 4caa2b8658de38379577384f3cbe008b69d0466b /Python/thread_pthread.h | |
parent | 27cc82217298335f2d42c5cb30937890af895d96 (diff) | |
parent | cef2a42dcf26de4a8bf66df6ee1c3198d9627a7e (diff) | |
download | cpython-2cbda449d3593a3ccc302088fab64585f733069a.tar.gz |
Null merge from 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 |