Handle sign extended numbers in parsing variable length opcodes.
This commit is contained in:
parent
8a743c344a
commit
7ff3d5f871
1 changed files with 3 additions and 1 deletions
|
@ -330,7 +330,9 @@ func parseScriptTemplate(script []byte, opcodemap map[byte]*opcode) ([]parsedOpc
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
off = i + 1 - op.length // beginning of data
|
off = i + 1 - op.length // beginning of data
|
||||||
if int(l) > len(script[off:]) {
|
// Disallow entries that do not fit script or were
|
||||||
|
// sign extended.
|
||||||
|
if int(l) >= len(script[off:]) || int(l) < 0 {
|
||||||
return retScript, StackErrShortScript
|
return retScript, StackErrShortScript
|
||||||
}
|
}
|
||||||
pop.data = script[off : off+int(l)]
|
pop.data = script[off : off+int(l)]
|
||||||
|
|
Loading…
Reference in a new issue