首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >导致SWC 110的payable[]公共地址和下载状态

导致SWC 110的payable[]公共地址和下载状态
EN

Ethereum用户
提问于 2021-04-09 16:39:14
回答 1查看 147关注 0票数 0

这是麦斯的输出

代码语言:javascript
复制
==== 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

以下是相关代码:

代码语言:javascript
复制
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);
}

有人能解释为什么调用recipients导致异常吗?我听不懂。我唯一能理解的就是用类型地址给0x0000000000000000000000000000000000000000解码tx数据,这是相关的吗?

EN

回答 1

Ethereum用户

回答已采纳

发布于 2021-04-14 15:00:21

根据这个问题,应该是假阳性。

票数 0
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/96978

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档