-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #3689 - adwinwhite:lseek64, r=RalfJung
Fix ICE caused by seeking past `i64::MAX` Make Miri behave the same as standard library on file seeking offset. Fixes #3680.
- Loading branch information
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//@ignore-target-windows: File handling is not implemented yet | ||
//@compile-flags: -Zmiri-disable-isolation | ||
|
||
use std::fs::remove_file; | ||
use std::io::{ErrorKind, Seek}; | ||
|
||
#[path = "../../utils/mod.rs"] | ||
mod utils; | ||
|
||
fn main() { | ||
let path = utils::prepare("miri_test_fs_seek_i64_max_plus_1.txt"); | ||
|
||
let mut f = std::fs::File::create(&path).unwrap(); | ||
let error = f.seek(std::io::SeekFrom::Start(i64::MAX as u64 + 1)).unwrap_err(); | ||
|
||
// It should be error due to negative offset. | ||
assert_eq!(error.kind(), ErrorKind::InvalidInput); | ||
|
||
// Cleanup | ||
remove_file(&path).unwrap(); | ||
} |