-
Notifications
You must be signed in to change notification settings - Fork 254
Open
Description
Version: v0.3.3: v0.3.3-70-g32a45ea1
Description: uint256 shifted = (a << shifts[0]) << shifts[1]; causes an overflow, and the subsequent return shifted; triggers a runtime error.
contract C {
function shiftBugExample() public pure returns (uint256) {
uint256 a = 1;
uint256[] memory shifts = new uint256[](2);
shifts[0] = 256;
shifts[1] = 1;
uint256 shifted = (a << shifts[0]) << shifts[1]; // Total shift size is 2**256 + 1
return shifted; // This should account the overflow, but due to the bug it may not.
}
}thread 'main' panicked at 'Found PointerValue(PointerValue { ptr_value: Value { name: "index_access43", address: 0x5f1e4114f1e0, is_const: false, is_null: false, is_undef: false, llvm_value: " %index_access43 = getelementptr i8, ptr %data42, i32 0", llvm_type: "ptr" } }) but expected the IntValue variant', /github/home/.cargo/registry/src/index.crates.io-6f17d22bba15001f/inkwell-0.2.0/src/values/enums.rs:286:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Metadata
Metadata
Assignees
Labels
No labels