mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 14:16:44 +00:00
add validation for the idx parameter
This commit is contained in:
parent
ba4a57043d
commit
caa8e5aa0f
1 changed files with 4 additions and 0 deletions
|
|
@ -77,6 +77,10 @@ func (sc *BlobTxSidecar) BlobHashes() []common.Hash {
|
||||||
// CellProofsAt returns the cell proofs for blob with index idx.
|
// CellProofsAt returns the cell proofs for blob with index idx.
|
||||||
// This method is only valid for sidecars with version 1.
|
// This method is only valid for sidecars with version 1.
|
||||||
func (sc *BlobTxSidecar) CellProofsAt(idx int) []kzg4844.Proof {
|
func (sc *BlobTxSidecar) CellProofsAt(idx int) []kzg4844.Proof {
|
||||||
|
if idx < 0 || idx >= len(sc.Blobs) {
|
||||||
|
log.Error("cellProofsAt called with out of bounds index", "index", idx, "blobs", len(sc.Blobs))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if sc.Version == 1 {
|
if sc.Version == 1 {
|
||||||
index := idx * kzg4844.CellProofsPerBlob
|
index := idx * kzg4844.CellProofsPerBlob
|
||||||
return sc.Proofs[index : index+kzg4844.CellProofsPerBlob]
|
return sc.Proofs[index : index+kzg4844.CellProofsPerBlob]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue