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

lseek wraps around! #241

Open
JustinCappos opened this issue May 11, 2024 · 0 comments
Open

lseek wraps around! #241

JustinCappos opened this issue May 11, 2024 · 0 comments
Assignees

Comments

@JustinCappos
Copy link
Member

The implementation of lseek has a bug where the data type (i32) isn't large enough and so it will wrap around on large files.

See 678ffb2#diff-97744cd8def1974ce0c338f5dedaa20ce129fd3b1a07b75cddff8eeff3e96b0eR75-R76 for an example.

This should be changed to i64, which will not overflow in practice, at least with current storage sizes. Note that Rust's std::io implementation uses an u64. POSIX's type is system dependent (because, of course it is), but is usually a i64. Note that POSIX also will return -1 and set errno to EOVERFLOW if you go past the end and would wrap around.

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