Skip to content

Commit

Permalink
Fix FullTracer getFromMemory() to filter lengths that are too high
Browse files Browse the repository at this point in the history
  • Loading branch information
fractasy committed Aug 28, 2024
1 parent ec4ad39 commit 27b7c56
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main_sm/fork_9/main/full_tracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ inline zkresult getFromMemory(Context &ctx, mpz_class &offset, mpz_class &length
uint64_t addrMem = offsetCtx + 0x20000;

result = "";

// If length is too high this is due to an OOG that will stop processing; just pretend to have read nothing
if (length > ctx.rom.constants.MAX_MEM_EXPANSION_BYTES)
{
zklog.error("getFromMemory() got length=" + length.get_str(10) + " > rom.constants.MAX_MEM_EXPANSION_BYTES=" + to_string(ctx.rom.constants.MAX_MEM_EXPANSION_BYTES));
return ZKR_SUCCESS;
}

double init = addrMem + double(offset.get_ui()) / 32;
double end = addrMem + double(offset.get_ui() + length.get_ui()) / 32;
uint64_t initCeil = ceil(init);
Expand Down

0 comments on commit 27b7c56

Please sign in to comment.