[issue13148] simple bug in mmap size check

Maxim Yanchenko report at bugs.python.org
Tue Oct 11 03:52:13 CEST 2011


Maxim Yanchenko <maxim.yanchenko at gs.com> added the comment:

Well, "n+1" is clearly outside the file, wile "n" is within and therefore valid.

Also, if your position is to forbid zero-size mmapping completely, then the checks inside "if (map_size == 0) {" don't make any sense, especially as they may or may fail.
>From the existing code, zero-size mmapping is OK as long as offset is OK, so the question is whether we consider offset pointing to the end of the file OK. To me, it's fine and valid, and there are valid cases like NumPy's zero-size arrays, hence the proposed patch.

Removing the check completely is a viable option too, it was already requested for special files:
http://bugs.python.org/issue12556

I believe users should have an ability to enjoy whatever their OS provides, and "deal with the consequences" as you said.

----------

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


More information about the Python-bugs-list mailing list