Skip to content

Commit

Permalink
Error out if there are fewer than four bytes to decode. (#510)
Browse files Browse the repository at this point in the history
* Error out if there are fewer than four bytes to decode.

* Update Decode.cpp
  • Loading branch information
Peter Goodman authored Apr 23, 2021
1 parent 8b5f739 commit 4eaf6e2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/Arch/AArch32/Decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3460,6 +3460,11 @@ bool AArch32Arch::DecodeInstruction(uint64_t address,
inst.arch = this;
inst.category = Instruction::kCategoryInvalid;
inst.operands.clear();

if (4ull > inst_bytes.size()) {
return false;
}

if (!inst.bytes.empty() && inst.bytes.data() == inst_bytes.data()) {
inst.bytes.resize(inst_bytes.size());
} else {
Expand Down

0 comments on commit 4eaf6e2

Please sign in to comment.