Skip to content

Commit 1a1e9b0

Browse files
author
Jonathan Turner
authored
Rollup merge of #36129 - eddyb:signal-exit-status, r=alexcrichton
Fix run-pass/signal-exit-status to not trigger UB by writing to NULL. `run-pass/signal-exit-status` has had UB (NULL dereference) since it was introduced in #10109. Fixes the test failure found by @camlorn while running under Windows Subsystem for Linux.
2 parents e69d65c + 8341f64 commit 1a1e9b0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/test/run-pass/signal-exit-status.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn main() {
1818
let args: Vec<String> = env::args().collect();
1919
if args.len() >= 2 && args[1] == "signal" {
2020
// Raise a segfault.
21-
unsafe { *(0 as *mut isize) = 0; }
21+
unsafe { *(1 as *mut isize) = 0; }
2222
} else {
2323
let status = Command::new(&args[0]).arg("signal").status().unwrap();
2424
assert!(status.code().is_none());

0 commit comments

Comments
 (0)