Skip to content

Commit

Permalink
Fix crash on parsing small files as image
Browse files Browse the repository at this point in the history
  • Loading branch information
twvd committed Nov 24, 2024
1 parent 80f724f commit c857ed6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion floppy/src/loaders/auto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl Autodetect {
return Ok(ImageType::Bitfile);
}
// Apple DiskCopy 4.2
if data[0x52..=0x53] == [0x01, 0x00] {
if data.len() > 0x53 && data[0x52..=0x53] == [0x01, 0x00] {
return Ok(ImageType::DC42);
}
// Raw image
Expand Down

0 comments on commit c857ed6

Please sign in to comment.