Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use libafl as libfuzzer for fuzzing #495

Merged
merged 4 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add `x86_64-pc-windows-gnu` support ([@Wolfyxon](https://github.com/Wolfyxon)) ([#634](https://github.com/wcampbell0x2a/backhand/pull/634))
- Add [zlib-rs](https://github.com/trifectatechfoundation/zlib-rs) support through `--feature gzip-zlib-rs`.

#### Security
- Prevent self referential dirs, which could cause a stack overflow ([#624](https://github.com/wcampbell0x2a/backhand/pull/495))
- Avoid high allocations for high inode count ([#624](https://github.com/wcampbell0x2a/backhand/pull/495))

### `backhand-cli`
- Add `--no-compression-options` to `add` and `replace` to remove compression options from image after modification.
- Add `--pad-len` to `replace` and `add` to control the length of end-of-image padding ([#604](https://github.com/wcampbell0x2a/backhand/pull/604))
Expand Down
3 changes: 2 additions & 1 deletion backhand/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ pub trait SquashFsReader: BufReadSeek + Sized {
)?;

let mut inodes = IntMap::default();
inodes.try_reserve(superblock.inode_count as usize)?;
// Be nice the allocator, and only allocate a max of u16::MAX count of Indoes
inodes.try_reserve(superblock.inode_count.min(u16::MAX as u32) as usize)?;

let byte_len = bytes.len();
let mut cursor = Cursor::new(bytes);
Expand Down
6 changes: 6 additions & 0 deletions backhand/src/squashfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,12 @@ impl<'b> Squashfs<'b> {
// BasicDirectory, ExtendedDirectory
InodeId::BasicDirectory | InodeId::ExtendedDirectory => {
// its a dir, extract all children inodes
if *found_inode == dir_inode {
error!("self referential dir to already read inode");
return Err(BackhandError::UnexpectedInode(
dir_inode.inner.clone(),
));
}
self.extract_dir(fullpath, root, found_inode, &self.id)?;
InnerNode::Dir(SquashfsDir::default())
}
Expand Down
Loading
Loading