Skip to content
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

Address sanitizer(ASAN) flag doesn't seem to work #45

Closed
StevenJiang1110 opened this issue Dec 16, 2020 · 1 comment
Closed

Address sanitizer(ASAN) flag doesn't seem to work #45

StevenJiang1110 opened this issue Dec 16, 2020 · 1 comment

Comments

@StevenJiang1110
Copy link

I want to use honggfuzz-rs to fuzz some unsafe code, however, the ASAN doesn't seem to work. For example, I use the code just from the example directory, and replace the code in main.rs with

#[macro_use] extern crate honggfuzz;

fn main() {
    loop {
        fuzz!(|data: &[u8]| {
            // use after free bug
            let xs = vec![0, 1, 2, 3];
            let y = xs.as_ptr();
            drop(xs);
            let z = unsafe { *y };
        });
    }
}

I fuzz the project with

RUSTFLAGS="-Z sanitizer=address" cargo hfuzz run example

However, the fuzzer can not detect the bug(Theres should be only one path).
There's one warning message from honggfuzz.
截屏2020-12-16 下午7 09 08
I hope you can check if this can work properly. Thanks a lot.

@PaulGrandperrin
Copy link
Member

Hi,
It's surprising but it's expected I would say:

if you want to force the bug to happen, you can override the optimization level:

RUSTFLAGS="-Z sanitizer=address -C opt-level=0 " cargo hfuzz run example

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

No branches or pull requests

2 participants