internal/ops: remove some bounds checks

Currently BCE is unable to understand that the accesses in the code are
safe. Added an explicit slice to make the length bounds obvious.

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
This commit is contained in:
Egon Elbre
2020-11-24 14:13:09 +01:00
committed by Elias Naur
parent 918a5da308
commit 21dc27b115
2 changed files with 8 additions and 8 deletions
+2
View File
@@ -143,6 +143,7 @@ func (op *opMacroDef) decode(data []byte) {
panic("invalid op")
}
bo := binary.LittleEndian
data = data[:9]
dataIdx := int(int32(bo.Uint32(data[1:])))
refsIdx := int(int32(bo.Uint32(data[5:])))
*op = opMacroDef{
@@ -157,6 +158,7 @@ func (m *macroOp) decode(data []byte, refs []interface{}) {
if opconst.OpType(data[0]) != opconst.TypeCall {
panic("invalid op")
}
data = data[:9]
bo := binary.LittleEndian
dataIdx := int(int32(bo.Uint32(data[1:])))
refsIdx := int(int32(bo.Uint32(data[5:])))