[New-bugs-announce] [issue3708] os.urandom(1.1): infinite loop

Daniel Diniz report at bugs.python.org
Thu Aug 28 01:30:12 CEST 2008

New submission from Daniel Diniz <ajaksu at gmail.com>:

Calling os.urandom(1 + float(x)) ends in a infinite loop due to a naive
condition check:

while len(bytes) < n:
    bytes += read(_urandomfd, n - len(bytes))

Trivial patch attached.

components: Library (Lib)
files: urandom.diff
keywords: patch
messages: 72050
nosy: ajaksu2
severity: normal
status: open
title: os.urandom(1.1): infinite loop
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file11277/urandom.diff

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list