[issue9611] FileIO not 64-bit safe under Windows

STINNER Victor report at bugs.python.org
Thu Dec 2 03:43:30 CET 2010


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

I agree that clamping is a nice solution, and attached patch implements it.

About the question of the loop: FileIO.readall() uses while(1) without checking for signals. It looks like new_buffersize() maximum size is not BIGCHUNK but (BIGCHUNK-1)*2:

        /* Keep doubling until we reach BIGCHUNK;
           then keep adding BIGCHUNK. */
        if (currentsize <= BIGCHUNK)
            return currentsize + currentsize;
        else
            return currentsize + BIGCHUNK;

Is it a bug? But (BIGCHUNK-1)*2 is always smaller than INT_MAX. So readall() isn't affected by this bug. Should it be patched?

posix.read() doesn't have the bug because it uses an "int" for the size.

----------
keywords: +patch
Added file: http://bugs.python.org/file19898/read_write_32bits.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9611>
_______________________________________


More information about the Python-bugs-list mailing list