Skip to content

Commit c0df60a

Browse files
wjmelementsclaude
andauthored
fix(delegatecall): correct gas overflow check to use top+4 (#107)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent a5faa9a commit c0df60a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/evm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1596,7 +1596,7 @@ static result_t doCall(context_t *callContext) {
15961596
OUT_OF_GAS;
15971597
}
15981598
callContext->gas -= gasCost;
1599-
if (UPPER(UPPER_P(callContext->top + 5)) || LOWER(UPPER_P(callContext->top + 5)) || UPPER(LOWER_P(callContext->top + 5)) || gas > L(callContext->gas)) {
1599+
if (UPPER(UPPER_P(callContext->top + 4)) || LOWER(UPPER_P(callContext->top + 4)) || UPPER(LOWER_P(callContext->top + 4)) || gas > L(callContext->gas)) {
16001600
gas = L(callContext->gas);
16011601
}
16021602
callContext->gas -= gas;

0 commit comments

Comments
 (0)