Handle sign extended numbers in parsing variable length opcodes.

This commit is contained in:
Owain G. Ainsworth 2013-10-08 23:21:40 +01:00
parent 8a743c344a
commit 7ff3d5f871

View file

@ -330,7 +330,9 @@ func parseScriptTemplate(script []byte, opcodemap map[byte]*opcode) ([]parsedOpc
return nil, err
}
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
}
pop.data = script[off : off+int(l)]