Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
Fixes source register range checking for the destination register ins…
Browse files Browse the repository at this point in the history
…tead. (#571)
  • Loading branch information
Lichtso authored May 23, 2024
1 parent 7ef666b commit 4261c25
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/assembler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ fn insn(opc: u8, dst: i64, src: i64, off: i64, imm: i64) -> Result<Insn, String>
if !(0..16).contains(&dst) {
return Err(format!("Invalid destination register {dst}"));
}
if dst < 0 || src >= 16 {
if !(0..16).contains(&src) {
return Err(format!("Invalid source register {src}"));
}
if off < i16::MIN as i64 || off > i16::MAX as i64 {
Expand Down

0 comments on commit 4261c25

Please sign in to comment.