You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The vulnerability lies in the gas calculation logic within the _callWithExactGasSafeReturnData function. Specifically, the variable g is assigned the current gas value before the gas check:
is performed without updating g to account for the gas used during this check. After this, the new gas value is calculated:
g :=sub(g, gasForCallExactCheck)
However, this calculation does not account for the gas used during the previous check, leading to an overestimated value of g. As a result, when performing the final gas comparison:
the comparison might falsely pass, leading to a scenario where the contract attempts to call the target with less gas than intended.
Impact
The impact of this vulnerability is that the contract may behave non-deterministically. Specifically, when the gas passed by the caller is strictly controlled, the contract might fail to revert as expected and proceed with the call, but with insufficient gas. This could lead to failed operations within the target contract, which contradicts the intended functionality of this contract . The call to the target contract may revert due to insufficient gas .
Solution
One way is to guess the gas that will be used for the check on the basis of the memory size and the dynamic behaviour of lt opcode.
The text was updated successfully, but these errors were encountered:
Vulnerability
The vulnerability lies in the gas calculation logic within the
_callWithExactGasSafeReturnData
function. Specifically, the variableg
is assigned the current gas value before the gas check:The subsequent check:
is performed without updating g to account for the gas used during this check. After this, the new gas value is calculated:
However, this calculation does not account for the gas used during the previous check, leading to an overestimated value of g. As a result, when performing the final gas comparison:
the comparison might falsely pass, leading to a scenario where the contract attempts to call the target with less gas than intended.
Impact
The impact of this vulnerability is that the contract may behave non-deterministically. Specifically, when the gas passed by the caller is strictly controlled, the contract might fail to revert as expected and proceed with the call, but with insufficient gas. This could lead to failed operations within the target contract, which contradicts the intended functionality of this contract . The call to the target contract may revert due to insufficient gas .
Solution
One way is to guess the gas that will be used for the check on the basis of the memory size and the dynamic behaviour of
lt
opcode.The text was updated successfully, but these errors were encountered: