From caa8e5aa0ffb301156f1564ff3b44466cebf0be0 Mon Sep 17 00:00:00 2001 From: maskpp Date: Mon, 14 Jul 2025 22:33:12 +0800 Subject: [PATCH] add validation for the idx parameter --- core/types/tx_blob.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/types/tx_blob.go b/core/types/tx_blob.go index e40e2d9e17..b57647fc49 100644 --- a/core/types/tx_blob.go +++ b/core/types/tx_blob.go @@ -77,6 +77,10 @@ func (sc *BlobTxSidecar) BlobHashes() []common.Hash { // CellProofsAt returns the cell proofs for blob with index idx. // This method is only valid for sidecars with version 1. 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 { index := idx * kzg4844.CellProofsPerBlob return sc.Proofs[index : index+kzg4844.CellProofsPerBlob]