Skip to content

Commit

Permalink
Fix crashing when testing if a mapped binary is an SREC format
Browse files Browse the repository at this point in the history
  • Loading branch information
emesare committed Aug 27, 2024
1 parent 6bbb117 commit c5389ea
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions view/bintxt/src/srec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ impl BinaryViewTypeBase for SRecViewConstructor {
let mut first_bytes = [0u8; READ_LEN];
let read_bytes = data.read(&mut first_bytes, 0);
let line = String::from_utf8_lossy(&first_bytes[0..read_bytes]);
if !line.is_ascii() {
return false;
}
let first_record: Result<Record, _> = line.parse();
// first record need to be and S0
matches!(first_record, Ok(Record::S0(_)))
Expand Down

0 comments on commit c5389ea

Please sign in to comment.