handle op_checksig with an empty signature on the stack.
Crash found by jy-p, fix by me.
This commit is contained in:
parent
e8321441af
commit
3aaafbd7fa
1 changed files with 7 additions and 0 deletions
|
@ -1662,6 +1662,13 @@ func opcodeCheckSig(op *parsedOpcode, s *Script) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// Signature actually needs needs to be longer than this, but we need
|
||||
// at least 1 byte for the below. btcec will check full length upon
|
||||
// parsing the signature.
|
||||
if len(sigStr) < 1 {
|
||||
return errors.New("Short signature")
|
||||
}
|
||||
|
||||
// Trim off hashtype from the signature string.
|
||||
hashType := sigStr[len(sigStr)-1]
|
||||
sigStr = sigStr[:len(sigStr)-1]
|
||||
|
|
Loading…
Reference in a new issue