]> git.lizzy.rs Git - rust.git/commitdiff
Add test for out-of-bounds reads.
authorScott Olson <scott@solson.me>
Wed, 6 Apr 2016 10:43:06 +0000 (04:43 -0600)
committerScott Olson <scott@solson.me>
Wed, 6 Apr 2016 10:43:06 +0000 (04:43 -0600)
test/errors.rs

index c6e6e16b889fc72e2abc8ddacdc95a2a226e991c..f6f5eae9d0fe6d0a328d07a27bf33df18b9a1960 100755 (executable)
@@ -30,3 +30,9 @@ fn undefined_byte_reads_are_rejected() -> u8 {
     let undef = unsafe { *v.get_unchecked(5) };
     undef + 1
 }
+
+#[miri_run]
+fn out_of_bounds_reads_are_rejected() -> u8 {
+    let v: Vec<u8> = vec![1, 2];
+    unsafe { *v.get_unchecked(5) }
+}