Skip to content

minor: fix mutable reference warning in examples/dynamic_analysis #2631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

Reverier-Xu
Copy link
Contributor

the compiler produces warnings in fuzzers/inprocess/dynamic_analysis:

warning: creating a mutable reference to mutable static is discouraged
   --> src/lib.rs:255:72
    |
255 |     let func_list = unsafe { OwnedMutPtr::from_raw_mut(Lazy::force_mut(&mut FUNCTION_LIST)) };
    |                                                                        ^^^^^^^^^^^^^^^^^^ mutable reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
    = note: this will be a hard error in the 2024 edition
    = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
    = note: `#[warn(static_mut_refs)]` on by default
help: use `addr_of_mut!` instead to create a raw pointer
    |
255 |     let func_list = unsafe { OwnedMutPtr::from_raw_mut(Lazy::force_mut(addr_of_mut!(FUNCTION_LIST))) };
    |                                                                        ~~~~~~~~~~~~~             +

this pr fix the warning.

@tokatoka
Copy link
Member

hi. thank you

@tokatoka tokatoka merged commit 261b6b5 into AFLplusplus:main Oct 24, 2024
92 of 95 checks passed
riesentoaster pushed a commit to riesentoaster/LibAFL that referenced this pull request Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants