mirror of
https://github.com/github/codeql.git
synced 2026-07-03 10:35:29 +02:00
Rust: Add a few more test cases for constants / constant propagation.
This commit is contained in:
@@ -68,6 +68,9 @@ fn test(var_string: &str, var_data: &[u8;16], var_u64: u64) {
|
||||
mc2.set_salt_u64(var_u64);
|
||||
mc2.set_salt_u64(var_u64 + 1);
|
||||
mc2.set_salt_u64((var_u64 << 32) ^ (var_u64 & 0xFFFFFFFF));
|
||||
mc2.set_salt_u64(1 << 4); // $ MISSING: Alert[rust/hard-coded-cryptographic-value]
|
||||
mc2.set_salt_u64(u64::MAX); // $ MISSING: Alert[rust/hard-coded-cryptographic-value]
|
||||
mc2.set_salt_u64(u64::MAX / 4); // $ MISSING: Alert[rust/hard-coded-cryptographic-value]
|
||||
|
||||
let mut key1 = "foo".to_string(); // $ MISSING: Alert[rust/hard-coded-cryptographic-value]
|
||||
key1 += "bar"; // $ MISSING: Alert[rust/hard-coded-cryptographic-value]
|
||||
@@ -76,4 +79,8 @@ fn test(var_string: &str, var_data: &[u8;16], var_u64: u64) {
|
||||
let mut key2 = "foo".to_string();
|
||||
key2 += var_string;
|
||||
let _ = MyCryptor::new(&key2);
|
||||
|
||||
let mut key3 = var_string.to_string();
|
||||
key3 += "bar";
|
||||
let _ = MyCryptor::new(&key3);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user