New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mmap.resize and offset #49532
Comments
This is first time to look at mmap module, so sorry if I'm saying From view of other functions, it seems that self->offset is offset from #if SIZEOF_SIZE_T > 4
newSizeHigh = (DWORD)((self->offset + new_size) >> 32);
newSizeLow = (DWORD)((self->offset + new_size) & 0xFFFFFFFF);
#else
newSizeHigh = 0;
newSizeLow = (DWORD)new_size; /* shouldn't add self->offset? this is
not doing same thing as SIZEOF_SIZE_T > 4 */
#endif And on unix part, And comment above function definition saids, / Is this really necessary? This could easily be done I think this function is not tested well. There is no test about |
Have a look at bpo-2733 http://bugs.python.org/issue2733 where I've just proposed a patch in this area. I'm also |
Yes, I noticed this issue while investigating bpo-2733. But sorry, I |
I investigated more. Following code crashed with bus error on coLinux. import mmap
def main():
align = mmap.ALLOCATIONGRANULARITY
with open("a.txt", "w") as f:
f.write("0" * align)
f.write("1" * align)
f.write("2" * align)
with open("a.txt", "r+") as f:
m = mmap.mmap(f.fileno(), align, offset=align*2)
m.resize(1)
print m[0] # bus error
if __name__ == '__main__':
main() On windows, failed with AccessDenied. (32bit Win2000) |
Here is a patch. |
I hope this is obvious too. Fixed in r69718. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: