Commit ff6590d
committed
fix: add bounds checks for proof node size and count in verify_proof
Enforce MAX_PROOF_NODE_SIZE (1024 bytes) and MAX_PROOF_NODES (65) limits
in verify_proof to prevent memory/CPU exhaustion from malicious proofs
with oversized RLP payloads or excessive node counts.
The node count is validated upfront before any decoding, and individual
node sizes are checked before RLP decoding in each iteration.1 parent 24e6b13 commit ff6590d
1 file changed
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
40 | 50 | | |
41 | 51 | | |
42 | 52 | | |
| |||
62 | 72 | | |
63 | 73 | | |
64 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
65 | 82 | | |
66 | 83 | | |
67 | 84 | | |
| |||
0 commit comments