Skip to content

Commit b9891dc

Browse files
committed
disassembly will stop decoding on unknown opcode but will return "true"
this means that the sequence is allowed but that particular opcode is not allowed
1 parent 7e9a64a commit b9891dc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

disassembly/decode.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ func (dsm *Disassembly) blessSequence(b int, a uint16, commit bool) bool {
163163
// program counter style (ie. address plus instruction byte count)
164164
//
165165
// sequence will stop if:
166+
// . an unknown opcode has been encountered
167+
//
166168
// . there is already blessed instruction between this and the next entry
167169
//
168170
// . a flow control instruction is encountered (this is normal and expected)
@@ -175,6 +177,12 @@ func (dsm *Disassembly) blessSequence(b int, a uint16, commit bool) bool {
175177
return true
176178
}
177179

180+
// if operator is unknown than end the sequence.
181+
operator := dsm.entries[b][a].Result.Defn.Operator
182+
if operator == "??" {
183+
return true
184+
}
185+
178186
next := a + uint16(dsm.entries[b][a].Result.ByteCount)
179187

180188
// break if address has looped around

0 commit comments

Comments
 (0)