Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using mulmod for division by zero did not throw an error, resulting in an incorrect return value. #1763

Open
Subway2023 opened this issue Mar 12, 2025 · 0 comments

Comments

@Subway2023
Copy link

Version: v0.3.3: v0.3.3-70-g32a45ea1
Description: solc + EVM encounters a division by zero error and throws an exception. However, solang + SVM does not throw an error and instead returns 0.

contract TestMulMod {
    function triggerError() external pure returns (uint256) {
        uint256 x = 10;
        uint256 y = 20;
        uint256 k = 0; // Division by zero

        uint256 result = mulmod(x, y, k);
        return result;
    }
}

solc+evm

call to TestMulMod.triggerError errored: Error occurred: revert.

solang+svm

result: 0x0000000000000000000000000000000000000000000000000000000000000000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant