LibAFL icon indicating copy to clipboard operation
LibAFL copied to clipboard

Check for casts from immutable references to mutable pointers

Open andreafioraldi opened this issue 3 years ago • 2 comments

In libafl there should be few casts between immutable refs to immutable pointers and then to mutable pointers. While it is now ok, with the evolution of the Rust compiler this will be UB as the compiler will be able to optimize the code under the assumption that the pointed memory under an immutable ref is immutable.

In the long term, we should replace these code points with valid alternatives.

andreafioraldi avatar Nov 14 '22 15:11 andreafioraldi

Even Casting a mut reference to a mut ptr is potentially UB, if the mut reference is still read from, after we write to the mut ptr

domenukk avatar Nov 17 '22 08:11 domenukk

Is this actionable at the moment, do you have an example for such a thing? Else I'd close this

domenukk avatar Apr 19 '23 14:04 domenukk

Closing for now, we should open bugs for individual ocurrences / fix them

domenukk avatar Mar 15 '24 16:03 domenukk