mirror of
https://jturnerusa.dev/cgit/gentoo-utils/
synced 2025-12-23 05:52:13 -06:00
gate atom parser fuzzer debug printing
This commit is contained in:
@@ -3,7 +3,10 @@
|
|||||||
|
|
||||||
use core::slice;
|
use core::slice;
|
||||||
use gentoo_utils::{Parseable, atom::Atom};
|
use gentoo_utils::{Parseable, atom::Atom};
|
||||||
use std::io::{self, Write};
|
use std::{
|
||||||
|
env::{self},
|
||||||
|
io::{self, Write},
|
||||||
|
};
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
pub unsafe extern "C" fn LLVMFuzzerTestOneInput(input: *const u8, len: usize) -> i32 {
|
pub unsafe extern "C" fn LLVMFuzzerTestOneInput(input: *const u8, len: usize) -> i32 {
|
||||||
@@ -32,10 +35,14 @@ pub unsafe extern "C" fn LLVMFuzzerTestOneInput(input: *const u8, len: usize) ->
|
|||||||
|
|
||||||
match (control, gentoo_utils) {
|
match (control, gentoo_utils) {
|
||||||
(Ok(_), Ok(_)) => {
|
(Ok(_), Ok(_)) => {
|
||||||
eprintln!("agreement that {str} is valid");
|
if env::var("FUZZER_LOG").is_ok() {
|
||||||
|
eprintln!("agreement that {str} is valid");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
(Err(_), Err(_)) => {
|
(Err(_), Err(_)) => {
|
||||||
eprintln!("agreement that {str} is invalid");
|
if env::var("FUZZER_LOG").is_ok() {
|
||||||
|
eprintln!("agreement that {str} is invalid");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
(Ok(_), Err(rest)) => {
|
(Ok(_), Err(rest)) => {
|
||||||
panic!("disagreement on {str}\ncontrol:Ok\ngentoo-utils:Err({rest})");
|
panic!("disagreement on {str}\ncontrol:Ok\ngentoo-utils:Err({rest})");
|
||||||
@@ -49,9 +56,11 @@ pub unsafe extern "C" fn LLVMFuzzerTestOneInput(input: *const u8, len: usize) ->
|
|||||||
> 1
|
> 1
|
||||||
}) =>
|
}) =>
|
||||||
{
|
{
|
||||||
eprintln!(
|
if env::var("FUZZER_LOG").is_ok() {
|
||||||
"disagreement, but we will allow it since its probably because of duplicated usdeps"
|
eprintln!(
|
||||||
);
|
"disagreement, but we will allow it since its probably because of duplicated usdeps"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
(Err(_), Ok(_)) => {
|
(Err(_), Ok(_)) => {
|
||||||
panic!("disagreement on {str}\ncontrol:Err\ngentoo-utils:Ok")
|
panic!("disagreement on {str}\ncontrol:Err\ngentoo-utils:Ok")
|
||||||
|
|||||||
Reference in New Issue
Block a user