Skip to content

Enable memory sanitizer tests again#435

Merged
fitzgen merged 1 commit into
rust-fuzz:mainfrom
Marcono1234:memory-sanitizer-test
Jan 27, 2026
Merged

Enable memory sanitizer tests again#435
fitzgen merged 1 commit into
rust-fuzz:mainfrom
Marcono1234:memory-sanitizer-test

Conversation

@Marcono1234

Copy link
Copy Markdown
Contributor

See also #323
It seems the test works on CI again

Reverts 7ad9e92 and adjusts the test slightly using the current example from https://doc.rust-lang.org/unstable-book/compiler-flags/sanitizer.html#memorysanitizer because the previous get_unchecked usage failed with "unsafe precondition(s) violated" instead of actually causing a sanitizer error.

Reverts 7ad9e92
and adjusts the test slightly using the current example from
https://doc.rust-lang.org/unstable-book/compiler-flags/sanitizer.html#memorysanitizer
because the previous `get_unchecked` usage failed with "unsafe precondition(s) violated"
instead of actually causing a sanitizer error.
Comment thread tests/tests/main.rs

fuzz_target!(|data: &[u8]| {
if let Some(x) = data.get(0) {
black_box(x);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have replaced the dbg!(x) here with black_box(x).

Is not strictly needed to enable the tests, but I think black_box should achieve the same goal here and might introduce less overhead than dbg!?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, maybe using black_box is actually a bad idea? See #436

@fitzgen fitzgen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@fitzgen fitzgen merged commit 0fd8c99 into rust-fuzz:main Jan 27, 2026
1 check passed
@Marcono1234 Marcono1234 deleted the memory-sanitizer-test branch March 24, 2026 10:14
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