Skip to content

Commit

Permalink
Check for negative nums
Browse files Browse the repository at this point in the history
  • Loading branch information
gagliardetto committed Apr 17, 2024
1 parent 6a20387 commit 0b9c4d7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions transaction.go
Expand Up @@ -505,6 +505,9 @@ func (tx *Transaction) UnmarshalWithDecoder(decoder *bin.Decoder) (err error) {
if err != nil {
return fmt.Errorf("unable to read numSignatures: %w", err)
}
if numSignatures < 0 {
return fmt.Errorf("numSignatures is negative")
}
if numSignatures > decoder.Remaining()/64 {
return fmt.Errorf("numSignatures %d is too large for remaining bytes %d", numSignatures, decoder.Remaining())
}
Expand Down

0 comments on commit 0b9c4d7

Please sign in to comment.