Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions executor/crates/calldata/src/bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ impl Parser<'_> {
if full_size == 0 {
Value::Array(Vec::new())
} else {
const MAX_ARRAY_CAPACITY: usize = 1024 * 1024; // 1M elements max
if full_size > MAX_ARRAY_CAPACITY {
return Err(anyhow::anyhow!("array capacity too large: {}", full_size));
}
stack.push(Frame::Array {
collected: Vec::with_capacity(full_size),
remaining: full_size,
Expand Down
5 changes: 5 additions & 0 deletions executor/src/wasi/genlayer_sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1301,6 +1301,11 @@ impl ContextVFS<'_> {
}
Some(data) => {
use crate::public_abi::ResultCode;
if data.is_empty() {
return Err(generated::types::Error::trap(
crate::anyhow_to_wasmtime(anyhow::anyhow!("leader nondet result is empty"))
));
}
let rest = &data[1..];
let res = match data[0] {
x if x == ResultCode::Return as u8 => rt::vm::RunOk::Return(rest.into()),
Expand Down
Loading