6 Commits

Author SHA1 Message Date
062e5bb60e test
All checks were successful
Gentoo Utils / build-oci-image (push) Successful in 6s
Gentoo Utils / check-format (push) Successful in 8s
Gentoo Utils / docs (push) Successful in 12s
Gentoo Utils / build (push) Successful in 20s
Gentoo Utils / test (push) Successful in 27s
Gentoo Utils / fuzz (push) Successful in 5m35s
2025-12-13 22:36:21 -06:00
c035fdccba test
Some checks failed
Gentoo Utils / build-oci-image (push) Successful in 8s
Gentoo Utils / check-format (push) Successful in 7s
Gentoo Utils / docs (push) Successful in 12s
Gentoo Utils / build (push) Successful in 20s
Gentoo Utils / fuzz (push) Failing after 13s
Gentoo Utils / test (push) Successful in 27s
2025-12-13 22:33:10 -06:00
00a311a506 ci: fix jobs not exiting on failure
Some checks failed
Gentoo Utils / build-oci-image (push) Successful in 7s
Gentoo Utils / check-format (push) Successful in 7s
Gentoo Utils / docs (push) Successful in 16s
Gentoo Utils / build (push) Successful in 26s
Gentoo Utils / test (push) Successful in 27s
Gentoo Utils / fuzz (push) Has been cancelled
2025-12-13 22:30:27 -06:00
8765fcd91f ci: build: remove debugging echos
ci: build: remove redundant source
2025-12-13 22:30:27 -06:00
072d9d35c2 ci: add fuzz job
ci: fuzz: add timeout

ci: fuzz: add fuzzer timeout
2025-12-13 22:30:24 -06:00
e7c1d6cc30 scripts: add fuzzer helper script 2025-12-13 22:29:23 -06:00
5 changed files with 30 additions and 41 deletions

View File

@@ -180,16 +180,3 @@ jobs:
run: |
meson setup -Ddocs=enabled docs
ninja rustdoc -C docs
grep:
runs-on: brutalisk
needs: [build-oci-image]
container:
image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }}
steps:
- name: Checkout repo
uses: actions/checkout@v5
- name: grep for patterns
run: |
git grep -E 'todo!|dbg!' -- '*.rs' && exit 1 || exit 0

View File

@@ -3,4 +3,3 @@ ninja rustfmt -C build
ninja rustdoc -C build
ninja clippy -C build
ninja test -C build
git grep -E 'todo!|dbg!' -- '*.rs' && exit 1 || exit 0

View File

@@ -4,12 +4,25 @@
use core::slice;
use gentoo_utils::{Parseable, atom::Atom};
use std::{
env::{self},
io::{self, Write},
sync::{LazyLock, Mutex},
};
#[derive(Debug)]
struct State {
input: io::Stdin,
output: io::Stdout,
}
#[unsafe(no_mangle)]
pub unsafe extern "C" fn LLVMFuzzerTestOneInput(input: *const u8, len: usize) -> i32 {
static PIPES: LazyLock<Mutex<State>> = LazyLock::new(|| {
Mutex::new(State {
input: io::stdin(),
output: io::stdout(),
})
});
let slice = unsafe { slice::from_raw_parts(input, len) };
let str = str::from_utf8(slice).expect("expected ascii input");
@@ -17,13 +30,13 @@ pub unsafe extern "C" fn LLVMFuzzerTestOneInput(input: *const u8, len: usize) ->
return -1;
}
let stdin = io::stdin();
let mut stdout = io::stdout();
let mut state = PIPES.lock().unwrap();
writeln!(&mut state.output, "{str}").unwrap();
let mut buffer = String::new();
writeln!(&mut stdout, "{str}").unwrap();
stdin.read_line(&mut buffer).unwrap();
state.input.read_line(&mut buffer).unwrap();
let control = match buffer.as_str().trim() {
"0" => Ok(()),
@@ -35,33 +48,24 @@ pub unsafe extern "C" fn LLVMFuzzerTestOneInput(input: *const u8, len: usize) ->
match (control, gentoo_utils) {
(Ok(_), Ok(_)) => {
if env::var("FUZZER_LOG").is_ok() {
eprintln!("agreement that {str} is valid");
}
}
(Err(_), Err(_)) => {
if env::var("FUZZER_LOG").is_ok() {
eprintln!("agreement that {str} is invalid");
}
}
(Ok(_), Err(rest)) => {
panic!("disagreement on {str}\ncontrol:Ok\ngentoo-utils:Err({rest})");
}
(Err(_), Ok(atom))
if atom.usedeps().iter().any(|usedep| {
atom.usedeps()
if atom
.usedeps()
.iter()
.filter(|u| *usedep.flag() == *u.flag())
.count()
> 1
}) =>
.any(|usedep| atom.usedeps().iter().filter(|u| usedep == *u).count() > 1) =>
{
if env::var("FUZZER_LOG").is_ok() {
eprintln!(
"disagreement, but we will allow it since its probably because of duplicated usdeps"
);
}
}
(Err(_), Ok(_)) => {
panic!("disagreement on {str}\ncontrol:Err\ngentoo-utils:Ok")
}

View File

@@ -2,13 +2,12 @@
import sys
from portage.dep import Atom
from portage.exception import InvalidAtom
for line in sys.stdin.buffer:
try:
Atom(line.decode().strip())
sys.stdout.buffer.write(b"0\n")
except InvalidAtom:
except:
sys.stdout.buffer.write(b"1\n")
finally:
sys.stdout.buffer.flush()

View File

@@ -102,7 +102,7 @@ impl Iterator for Ebuilds {
Ok(ebuild) => break Some(Ok(ebuild)),
Err(e) => break Some(Err(e)),
},
Err(e) => break Some(Err(Error::ReadDir(self.0.clone(), e))),
_ => todo!(),
}
}
}