fix test_new_from_file_crafted_executable for m1 (#26009)
* fix test_new_from_file_crafted_executable for m1 * re-add old assert/comment, but disable for aarch64
This commit is contained in:
parent
1a87b6cd97
commit
50eb9965ab
|
@ -879,16 +879,22 @@ pub mod tests {
|
||||||
let accounts = av.accounts(0);
|
let accounts = av.accounts(0);
|
||||||
let account = accounts.first().unwrap();
|
let account = accounts.first().unwrap();
|
||||||
|
|
||||||
|
// upper 7-bits are not 0, so sanitization should fail
|
||||||
|
assert!(!account.sanitize_executable());
|
||||||
|
|
||||||
// we can observe crafted value by ref
|
// we can observe crafted value by ref
|
||||||
{
|
{
|
||||||
let executable_bool: &bool = &account.account_meta.executable;
|
let executable_bool: &bool = &account.account_meta.executable;
|
||||||
// Depending on use, *executable_bool can be truthy or falsy due to direct memory manipulation
|
// Depending on use, *executable_bool can be truthy or falsy due to direct memory manipulation
|
||||||
// assert_eq! thinks *executable_bool is equal to false but the if condition thinks it's not, contradictorily.
|
// assert_eq! thinks *executable_bool is equal to false but the if condition thinks it's not, contradictorily.
|
||||||
assert!(!*executable_bool);
|
assert!(!*executable_bool);
|
||||||
|
#[cfg(not(target_arch = "aarch64"))]
|
||||||
|
{
|
||||||
const FALSE: bool = false; // keep clippy happy
|
const FALSE: bool = false; // keep clippy happy
|
||||||
if *executable_bool == FALSE {
|
if *executable_bool == FALSE {
|
||||||
panic!("This didn't occur if this test passed.");
|
panic!("This didn't occur if this test passed.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
assert_eq!(*account.ref_executable_byte(), crafted_executable);
|
assert_eq!(*account.ref_executable_byte(), crafted_executable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue