Skip to content

Commit

Permalink
core/types: fix unmarshalling of BlobTx values (#27939)
Browse files Browse the repository at this point in the history
FromBig returns true *when overflow occurs*
  • Loading branch information
lightclient authored and manav2401 committed Feb 13, 2024
1 parent f1bb80a commit 15765ea
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions core/types/transaction_marshalling.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,29 +373,29 @@ func (tx *Transaction) UnmarshalJSON(input []byte) error {
itx.BlobHashes = dec.BlobVersionedHashes

// signature R
var ok bool
var overflow bool
if dec.R == nil {
return errors.New("missing required field 'r' in transaction")
}
itx.R, ok = uint256.FromBig((*big.Int)(dec.R))
if !ok {
itx.R, overflow = uint256.FromBig((*big.Int)(dec.R))
if overflow {
return errors.New("'r' value overflows uint256")
}
// signature S
if dec.S == nil {
return errors.New("missing required field 's' in transaction")
}
itx.S, ok = uint256.FromBig((*big.Int)(dec.S))
if !ok {
itx.S, overflow = uint256.FromBig((*big.Int)(dec.S))
if overflow {
return errors.New("'s' value overflows uint256")
}
// signature V
vbig, err := dec.yParityValue()
if err != nil {
return err
}
itx.V, ok = uint256.FromBig(vbig)
if !ok {
itx.V, overflow = uint256.FromBig(vbig)
if overflow {
return errors.New("'v' value overflows uint256")
}
if itx.V.Sign() != 0 || itx.R.Sign() != 0 || itx.S.Sign() != 0 {
Expand Down

0 comments on commit 15765ea

Please sign in to comment.