fix: check empty leader nondet result before indexing data[0]#319
fix: check empty leader nondet result before indexing data[0]#319lau90eth wants to merge 1 commit into
Conversation
Fixes index-out-of-bounds panic when a malicious leader injects Bytes::new() as a nondet result. data[0] would panic if data is empty. Affected: executor/src/wasi/genlayer_sdk.rs ~L1305 PoC: https://github.com/lau90eth/genvm-nondet-panic
|
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughIn ChangesEmpty leader nondet result guard
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
👋 This PR targeted
|
Summary
Fixes index-out-of-bounds panic when a malicious leader injects
Bytes::new()as a nondet result.Root Cause
In
executor/src/wasi/genlayer_sdk.rs~L1305, insideleader_nondet_resultshandling:dataarrives from the wire viacalldata::decode_objwith no per-element length validation. A malicious leader can injectBytes::new()(empty bytes), causingdata[0]to panic and crashing the validator.Impact
Consensus liveness compromised — validator crashes on empty nondet result, preventing finalization.
Fix
Added
data.is_empty()check beforedata[0]access, returning a proper error instead of panicking.PoC
https://github.com/lau90eth/genvm-nondet-panic
Related
Finding originally submitted to GenLayer Builders Program portal.
Summary by CodeRabbit