mirror of
https://github.com/btcsuite/btcd.git
synced 2024-11-19 18:00:11 +01:00
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
@ -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 New Issue
Block a user