This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dalke
Recipients anthon, dalke, pitrou
Date 2008-09-11.22:58:39
SpamBayes Score 1.020901e-09
Marked as misclassified No
Message-id <1221173973.2.0.662537288794.issue3531@psf.upfronthosting.co.za>
In-reply-to
Content
I'm still undecided on if this is a bug or not.  The problem occurs even 
when I'm not reading "data from a file of an unknown size."  My example 
causes a MemoryError on my machine even though the file I'm reading 
contains 0 bytes.

The problem is Python's implementation is "alloc the requested bytes and 
truncate if needed" vs what I expected "read chunks at a time up to the 
requested number of bytes."  There's nothing in the documentation which 
states the implementation, although "Note that this method may call the 
underlying C function fread more than once in an effort to acquire as 
close to size bytes as possible." leans slightly towards my 
interpretation.

I looked a little for real-world cases that could cause a denial-of-
service attack but didn't find one.

If there is a problem, it will occur very rarely.  Go ahead an mark it 
as "will not fix" or something similar.  I don't think the change in the 
code is justifiable.
History
Date User Action Args
2008-09-11 22:59:33dalkesetrecipients: + dalke, anthon, pitrou
2008-09-11 22:59:33dalkesetmessageid: <1221173973.2.0.662537288794.issue3531@psf.upfronthosting.co.za>
2008-09-11 22:58:40dalkelinkissue3531 messages
2008-09-11 22:58:39dalkecreate