Skip to content

Commit bcc7075

Browse files
committed
Check that chdir fails for non-utf8 paths
1 parent 0eed5e6 commit bcc7075

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// ignore-windows: TODO the windows hook is not done yet
2+
// compile-flags: -Zmiri-disable-isolation
3+
4+
extern {
5+
pub fn chdir(dir: *const u8) -> i32;
6+
}
7+
8+
fn main() {
9+
let path = vec![0xc3u8, 0x28, 0];
10+
// test that `chdir` errors with invalid utf-8 path
11+
unsafe { chdir(path.as_ptr()) }; //~ ERROR is not a valid utf-8 string
12+
}

0 commit comments

Comments
 (0)