initial commit
All checks were successful
CI / fuzz (push) Successful in 1m41s
CI / lint (push) Successful in 16s
CI / test (push) Successful in 22s

This commit is contained in:
Kamal Tufekcic 2026-07-27 10:12:04 +03:00
commit a2922b8bad
59 changed files with 2684583 additions and 0 deletions

View file

@ -0,0 +1,28 @@
#![no_main]
//! The ELF64 reader must return `Err` on any malformed input, never panic — no out-of-bounds index,
//! no arithmetic overflow. `from_bytes` parses section headers, the symbol table, and the relocation
//! map straight out of attacker-controlled bytes; this drives it and every allocated-section accessor.
use source2rosetta::elf::CodeImage;
use libfuzzer_sys::fuzz_target;
fuzz_target!(|data: &[u8]| {
let Ok(img) = CodeImage::from_bytes(data.to_vec()) else {
return;
};
// Reloc-driven / eh_frame walks over whatever the header claimed.
let _ = img.eh_frame_functions();
let targets = img.code_pointer_targets();
// Pointer/string reads at reloc slots and their values (bounded — inputs are small anyway).
for (slot, val) in img.reloc_slots().take(256) {
let _ = img.read_ptr(slot);
let _ = img.read_c_string(val);
let _ = img.is_code(val);
let _ = img.ptrs_to(val);
}
for &t in targets.iter().take(64) {
let _ = img.code_at(t);
let _ = img.rodata_at(t, 32);
let _ = img.read_i64(t);
let _ = img.read_u32(t);
}
});