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
// SPDX-License-Identifier: MITcontractBugDetection {
uint256public storedValue;
uint8constant MAX_UINT8 =255;
function storeShiftedValue(uint256input) public {
// Inline assembly to manipulate bits directlyassembly {
let shifted :=shl(2, input) // Shift left by 2, may overflow if input is not managedsstore(storedValue.slot, shifted) // Store the shifted value to storedValue
}
storedValue =computeHashWithSideEffect(uint8(storedValue % (MAX_UINT8 +1)));
}
function computeHashWithSideEffect(uint8input) internalreturns (uint256) {
// Function with potential side-effect in the expressionuint8 interimValue = input;
bytes32 hash =keccak256(abi.encodePacked(interimValue +modifyState()));
returnuint256(hash);
}
function modifyState() internalreturns (uint8) {
storedValue = storedValue +1; // Intentional side-effect to modify statereturn1; // Return a small constant value
}
}
Environment
Steps to Reproduce
However, the program can be successfully compiled into bytecode.
The text was updated successfully, but these errors were encountered: