0

This is the output of mythril

==== Exception State ====
SWC ID: 110
Severity: Medium
Contract: XXXXXXX
Function name: recipients(uint256)
PC address: 2067
Estimated Gas Usage: 1089 - 1184
An assertion violation was triggered.
It is possible to trigger an assertion violation. Note that Solidity assert() statements should only be used to check invariants. Review the transaction trace generated for this issue and either make sure your program logic is correct, or use require() instead of assert() if your goal is to constrain user inputs or enforce preconditions. Remember to validate inputs from both callers (for instance, via passed arguments) and callees (for instance, via return values).
--------------------
In file: something.sol:42

address payable[] public recipients
--------------------
Initial State:

Account: [CREATOR], balance: 0x0, nonce:0, storage:{}
Account: [ATTACKER], balance: 0x0, nonce:0, storage:{}
Account: [SOMEGUY], balance: 0x0, nonce:0, storage:{}

Transaction Sequence:

Caller: [CREATOR], calldata: , value: 0x0
Caller: [ATTACKER], function: recipients(uint256), txdata: 0xd1bc76a10000000000000000000000000000000000000000000000000000000000000000, value: 0x0

Here is the relevant code:

address payable[] public recipients;

...

modifier onlyOwner {
    require(
        msg.sender == owner,
        "Only the contract owner can call this function"
    );
    _;
}

function addRecipient(address payable payee) public onlyOwner {
    recipients.push(payee);
}

Can anybody explain why calling recipients causing the exception? I am not able to understand. The only thing I can understand is decoding tx data with type address gives 0x0000000000000000000000000000000000000000, is that relevant?

2
  • Probably just the out of bounds for the array. – hrkrshnn Apr 9 at 17:54
  • @hrkrshnn possibly, but it shouldn't be medum severity in that case. – hack3r_0m Apr 9 at 18:18
0

According to this issue, It should be False Positive.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.