Add streaming CPIO reader and writer

The Magisk boot image patcher still reads all the entries into memory
for simplicity, but everything else now uses the streaming reader.

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
This commit is contained in:
Andrew Gunnerson
2023-09-29 17:39:53 -04:00
parent 61129e8ec7
commit 164274eb97
10 changed files with 621 additions and 279 deletions
+3 -2
View File
@@ -1,6 +1,6 @@
#[cfg(not(windows))]
mod fuzz {
use std::io::Cursor;
use std::{io::Cursor, sync::atomic::AtomicBool};
use avbroot::format::cpio;
use honggfuzz::fuzz;
@@ -8,8 +8,9 @@ mod fuzz {
pub fn main() {
loop {
fuzz!(|data: &[u8]| {
let cancel_signal = AtomicBool::new(false);
let reader = Cursor::new(data);
let _ = cpio::load(reader, true);
let _ = cpio::load(reader, true, &cancel_signal);
});
}
}