Commit 01270d2d authored by George Knee's avatar George Knee Committed by GitHub

add regression test (#11519)

parent 698633cd
...@@ -40,6 +40,15 @@ func FuzzExecutionPayloadUnmarshal(f *testing.F) { ...@@ -40,6 +40,15 @@ func FuzzExecutionPayloadUnmarshal(f *testing.F) {
}) })
} }
func TestExecutionPayloadUnmarshalMaliciousData(t *testing.T) {
// Prior to https://github.com/ethereum-optimism/optimism/pull/10362 this causes a panic
// It should return an error and not panic
data := []byte("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\x00\x02\x00\x000000000000000000000000000000000000000000000000000000000000000000\x00\x02\x00\x000000")
var payload ExecutionPayload
err := payload.UnmarshalSSZ(BlockV2, uint32(len(data)), bytes.NewReader(data))
require.Error(t, err)
}
// FuzzExecutionPayloadMarshalUnmarshal checks that our SSZ encoding>decoding round trips properly // FuzzExecutionPayloadMarshalUnmarshal checks that our SSZ encoding>decoding round trips properly
func FuzzExecutionPayloadMarshalUnmarshalV1(f *testing.F) { func FuzzExecutionPayloadMarshalUnmarshalV1(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte, a, b, c, d uint64, extraData []byte, txs uint16, txsData []byte) { f.Fuzz(func(t *testing.T, data []byte, a, b, c, d uint64, extraData []byte, txs uint16, txsData []byte) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment