Skip to content

Commit 3aa472c

Browse files
committed
Rust: Update inline expectations
1 parent d93e516 commit 3aa472c

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

rust/ql/test/query-tests/security/CWE-825/AccessAfterLifetime.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
| lifetime.rs:433:7:433:8 | p1 | lifetime.rs:383:31:383:37 | &raw mut my_pair | lifetime.rs:433:7:433:8 | p1 | Access of a pointer to $@ after its lifetime has ended. | lifetime.rs:382:11:382:17 | my_pair | my_pair |
1919
| lifetime.rs:459:13:459:14 | p1 | lifetime.rs:442:17:442:23 | &my_val | lifetime.rs:459:13:459:14 | p1 | Access of a pointer to $@ after its lifetime has ended. | lifetime.rs:441:6:441:11 | my_val | my_val |
2020
| lifetime.rs:460:13:460:31 | get_ptr_from_ref(...) | lifetime.rs:442:17:442:23 | &my_val | lifetime.rs:460:13:460:31 | get_ptr_from_ref(...) | Access of a pointer to $@ after its lifetime has ended. | lifetime.rs:441:6:441:11 | my_val | my_val |
21-
| lifetime.rs:659:15:659:18 | ref1 | lifetime.rs:654:31:654:35 | &str1 | lifetime.rs:659:15:659:18 | ref1 | Access of a pointer to $@ after its lifetime has ended. | lifetime.rs:653:8:653:11 | str1 | str1 |
22-
| lifetime.rs:667:14:667:17 | ref1 | lifetime.rs:654:31:654:35 | &str1 | lifetime.rs:667:14:667:17 | ref1 | Access of a pointer to $@ after its lifetime has ended. | lifetime.rs:653:8:653:11 | str1 | str1 |
2321
| lifetime.rs:667:14:667:17 | ref1 | lifetime.rs:655:11:655:25 | &raw const str2 | lifetime.rs:667:14:667:17 | ref1 | Access of a pointer to $@ after its lifetime has ended. | lifetime.rs:651:7:651:10 | str2 | str2 |
2422
| lifetime.rs:789:12:789:13 | p1 | lifetime.rs:781:9:781:19 | &my_local10 | lifetime.rs:789:12:789:13 | p1 | Access of a pointer to $@ after its lifetime has ended. | lifetime.rs:779:6:779:15 | my_local10 | my_local10 |
2523
| lifetime.rs:808:23:808:25 | ptr | lifetime.rs:798:9:798:12 | &val | lifetime.rs:808:23:808:25 | ptr | Access of a pointer to $@ after its lifetime has ended. | lifetime.rs:796:6:796:8 | val | val |

rust/ql/test/query-tests/security/CWE-825/lifetime.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,20 +651,20 @@ pub fn test_implicit_derefs() {
651651
let str2;
652652
{
653653
let str1 = "bar";
654-
str2 = "foo".to_string() + &str1; // $ Source[rust/access-after-lifetime-ended]=str1
654+
str2 = "foo".to_string() + &str1;
655655
ref1 = &raw const str2; // $ Source[rust/access-after-lifetime-ended]=str2
656656
} // (str1 goes out of scope, but it's been copied into str2)
657657

658658
unsafe {
659-
let v1 = &*ref1; // $ SPURIOUS: Alert[rust/access-after-lifetime-ended]=str1
659+
let v1 = &*ref1;
660660
println!(" v1 = {v1}");
661661
}
662662
} // (str2 goes out of scope, thus ref1 is dangling)
663663

664664
use_the_stack();
665665

666666
unsafe {
667-
let v2 = &*ref1; // $ Alert[rust/access-after-lifetime-ended]=str2 SPURIOUS: Alert[rust/access-after-lifetime-ended]=str1
667+
let v2 = &*ref1; // $ Alert[rust/access-after-lifetime-ended]=str2
668668
println!(" v2 = {v2} (!)"); // corrupt in practice
669669
}
670670
}

0 commit comments

Comments
 (0)