mirror of
https://github.com/python/cpython.git
synced 2025-10-13 10:23:28 +00:00
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.
This commit is contained in:
parent
fd7f19ea67
commit
b98a36e8f3
2 changed files with 5 additions and 1 deletions
|
@ -13,6 +13,10 @@ Core and Builtins
|
||||||
Library
|
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
|
- Issue #26386: Fixed ttk.TreeView selection operations with item id's
|
||||||
containing spaces.
|
containing spaces.
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ py_getrandom(void *buffer, Py_ssize_t size, int raise)
|
||||||
to 1024 bytes */
|
to 1024 bytes */
|
||||||
n = Py_MIN(size, 1024);
|
n = Py_MIN(size, 1024);
|
||||||
#else
|
#else
|
||||||
n = size;
|
n = Py_MIN(size, INT_MAX);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue