Maxim Yanchenko added the comment:
> You got lucky, since the offset must be a multiple of the page size.
That's why our header is exactly the page size :)
> Here's what POSIX says
Then it's just another discrepancy between POSIX and Linux, as I received
ENOMEM instea
Maxim Yanchenko added the comment:
tried on newer Linux - crashes with my patch.
So I'll be thinking about a workaround, probably a fix for NumPy to avoid using
mmap in such cases but still provide uniform interface to avoid making special
conditional handling in all my scripts.
Ther
Maxim Yanchenko 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, especia
Maxim Yanchenko added the comment:
First of all, it doesn't fail (at least on Linux), I tested it before posting.
And the latest, it's not like I'm just stalking around and reading Python
sources for fun. It's a real and pretty valid case, I hit it while upgrading
ou
New submission from Maxim Yanchenko :
The condition contradicts the exception text:
if (offset >= st.st_size) {
PyErr_SetString(PyExc_ValueError,
"mmap offset is greater than file size");
return NULL;