changeset: 102033:e028e86a5b73 branch: 3.5 parent: 102031:a36238de31ae user: Victor Stinner date: Tue Jun 14 16:31:35 2016 +0200 files: Misc/NEWS Python/random.c description: Fix os.urandom() using getrandom() on Linux Issue #27278: Fix os.urandom() implementation using getrandom() on Linux. Truncate size to INT_MAX and loop until we collected enough random bytes, instead of casting a directly Py_ssize_t to int. diff -r a36238de31ae -r e028e86a5b73 Misc/NEWS --- a/Misc/NEWS Tue Jun 14 15:04:44 2016 +0200 +++ b/Misc/NEWS Tue Jun 14 16:31:35 2016 +0200 @@ -13,6 +13,10 @@ Library ------- +- Issue #27278: Fix os.urandom() implementation using getrandom() on Linux. + Truncate size to INT_MAX and loop until we collected enough random bytes, + instead of casting a directly Py_ssize_t to int. + - Issue #26386: Fixed ttk.TreeView selection operations with item id's containing spaces. diff -r a36238de31ae -r e028e86a5b73 Python/random.c --- a/Python/random.c Tue Jun 14 15:04:44 2016 +0200 +++ b/Python/random.c Tue Jun 14 16:31:35 2016 +0200 @@ -143,7 +143,7 @@ to 1024 bytes */ n = Py_MIN(size, 1024); #else - n = size; + n = Py_MIN(size, INT_MAX); #endif errno = 0;