Skip to content

Commit

Permalink
Fix potential assert in case or corrupted stream
Browse files Browse the repository at this point in the history
  • Loading branch information
ypo committed Feb 6, 2025
1 parent 23a4690 commit bcda1aa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/common/alccodec/alcnocode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ impl AlcCodec for AlcNoCode {
}

debug_assert!(fti[0] == lct::Ext::Fti as u8);
debug_assert!(fti[1] == 4);
if fti[1] != 4 {
return Err(FluteError::new(format!(
"Wrong exten header size {} != 4 for FTI",
fti[1]
)));
}

let transfer_length = u64::from_be_bytes(fti[2..10].as_ref().try_into().unwrap()) >> 16;
let encoding_symbol_length = u16::from_be_bytes(fti[10..12].as_ref().try_into().unwrap());
Expand Down

0 comments on commit bcda1aa

Please sign in to comment.