handle op_checksig with an empty signature on the stack.

Crash found by jy-p, fix by me.
This commit is contained in:
Owain G. Ainsworth 2013-11-07 17:09:22 +00:00
parent e8321441af
commit 3aaafbd7fa

View file

@ -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]