Skip to content

Commit 68c7058

Browse files
authored
core/stateless: fix parsing an empty witness (#34683)
This is to fix a crasher in keeper.
1 parent 21b1936 commit 68c7058

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/stateless/encoding.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package stateless
1818

1919
import (
20+
"errors"
2021
"io"
2122

2223
"github.com/ethereum/go-ethereum/common/hexutil"
@@ -42,6 +43,9 @@ func (w *Witness) ToExtWitness() *ExtWitness {
4243

4344
// FromExtWitness converts the consensus witness format into our internal one.
4445
func (w *Witness) FromExtWitness(ext *ExtWitness) error {
46+
if len(ext.Headers) == 0 {
47+
return errors.New("witness must contain at least one header")
48+
}
4549
w.Headers = ext.Headers
4650

4751
w.Codes = make(map[string]struct{}, len(ext.Codes))

0 commit comments

Comments
 (0)