You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code above writes the full length of the file from each and every page. So, even though a page is at most 4096 bytes, the write_page routine is trying to copy data from each page far past the end of the page boundary. This puts random data into the file.
A PR with a suggested fix is forthcoming.
The text was updated successfully, but these errors were encountered:
The contents of memory mapped files created using mmap are not written correctly.
The following test program (adapted from https://stackoverflow.com/questions/26259421/use-mmap-in-c-to-write-into-memory) can reproduce the problem:
The following commands will run the test.
The result should be that testin and testout are the same.
Instead testout is mostly filled with "random" data.
The root cause of the problem is this line of code:
Fiwix/mm/mmap.c
Line 288 in abc14a0
The code above writes the full length of the file from each and every page. So, even though a page is at most 4096 bytes, the write_page routine is trying to copy data from each page far past the end of the page boundary. This puts random data into the file.
A PR with a suggested fix is forthcoming.
The text was updated successfully, but these errors were encountered: