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

cargo-fuzz is not happy with some of the code paths #655

Closed
liuw opened this issue Jan 2, 2025 · 5 comments
Closed

cargo-fuzz is not happy with some of the code paths #655

liuw opened this issue Jan 2, 2025 · 5 comments

Comments

@liuw
Copy link

liuw commented Jan 2, 2025

The iced-x86 crate is used by Cloud Hypervisor to decode instructions.

I recently wrote this cloud-hypervisor/cloud-hypervisor#6895. It fuzzes a lot of the code paths in iced-x86.

cargo-fuzz reported a few leaks. Upon closer inspection they are both from iced-x86. I disabled the two features for now to placate libfuzzer.

Looking at the output from the fuzzer, it is likely complaining these two places (v1.21.0).

let len_data = Box::leak(Box::new(new_vec)).as_ptr();

(decode, Box::into_raw(Box::new(handler)) as *const OpCodeHandler)

I don't think these are accidental leaks. Not sure what's the best way to fix them.

@wtfsck
Copy link
Member

wtfsck commented Jan 2, 2025

can you test against master

@liuw
Copy link
Author

liuw commented Jan 2, 2025

I did take a brief look at the difference between master and v1.21.0. I see that the formatter has been changed, but the table_de module code which calls Box::into_raw is still there. I expect libfuzzer will continue to complain about the latter.

I can try finding some time to reproduce this on master. That's going to take a while though.

@wtfsck
Copy link
Member

wtfsck commented Jan 2, 2025

There's at least one pr that possibly fixed this #528

@liuw
Copy link
Author

liuw commented Jan 2, 2025

Good to know. I will circle back when I try out master.

@liuw
Copy link
Author

liuw commented Jan 2, 2025

Both leaks are gone in the master branch. Closing this.

@liuw liuw closed this as completed Jan 2, 2025
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