Skip to content

Commit

Permalink
Check vromf size
Browse files Browse the repository at this point in the history
  • Loading branch information
FlareFlo committed Aug 31, 2024
1 parent 17f78fd commit fed7465
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
34 changes: 17 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion src/subcommands/unpack_vromf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ use color_eyre::{
eyre::{ContextCompat, Result},
Help,
};
use tracing::info;
use color_eyre::eyre::bail;
use tracing::{error, info};
use wt_blk::{
blk::util::maybe_blk,
vromf::{BlkOutputFormat, File as BlkFile, VromfUnpacker},
Expand Down Expand Up @@ -188,6 +189,14 @@ fn parse_and_write_one_vromf(
ffmpeg: Arc<ImageConverter>,
check_integrity: bool,
) -> Result<()> {
if let Some(meta) = file.meta() {
match meta.len() {
0 => {bail!("Vromf is zero bytes long {:?}", file.path())}
len @ 0..=1000 => {error!("Vromf is very small ({len} bytes) {:?}", file.path())}
_ => {}
}
}

let parser = VromfUnpacker::from_file(&file, check_integrity)?;

let mut vromf_name = PathBuf::from(file.path().file_name().ok_or(CliError::InvalidPath)?);
Expand Down

0 comments on commit fed7465

Please sign in to comment.