Skip to content

Commit

Permalink
fix: add check for empty file
Browse files Browse the repository at this point in the history
  • Loading branch information
rozukke committed Dec 18, 2024
1 parent 4b725b0 commit a3a3e24
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ impl RunState {
}

pub fn from_raw(raw: &[u16]) -> Result<RunState> {
if raw.len() == 0 {
exception!("provided file is empty");
}

let orig = raw[0] as usize;
if orig as usize + raw.len() > MEMORY_MAX {
exception!("assembly file is too long and cannot fit in memory");
Expand Down

0 comments on commit a3a3e24

Please sign in to comment.