Skip to content
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

Bus error if 'offset' of mmap is greater than 2gb. #31

Open
peekpi opened this issue Jan 3, 2021 · 1 comment
Open

Bus error if 'offset' of mmap is greater than 2gb. #31

peekpi opened this issue Jan 3, 2021 · 1 comment

Comments

@peekpi
Copy link

peekpi commented Jan 3, 2021

js code to reproduce:

...
const mmap = require("mmap-io")
const fd = ... // openSync, ftruncateSync, etc
const buf = mmap.map(mmap.PAGESIZE, mmap.PROT_WRITE | mmap.PROT_READ,  mmap.MAP_SHARED, fd, 0x80000000);
console.log(buf); // will cause bus error;
...

The possible reason is the use of int:

const size_t offset = static_cast<size_t>(get_v<int>(info[4], 0));

@UmanShahzad
Copy link

We made https://github.com/ipinfo/mmap-utils with a fix for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants