question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Calldatasize constraints

See original GitHub issue

When there is a constraint on some calldata[x] != 0 then there should be a constraint that the calldatasize > x

Take the example by Chofhe from discord( @nbanmp ):

contract Suicide {
  uint256 isAllowed = 0;

  function kill(address addr, uint256 isAllowed) {
    require(isAllowed == 42);
    require(msg.data.length == 4);
    selfdestruct(addr);
  }
}

Where mythril now reports a false positive

Proposed solution

Add the following constraint on calldataload:

# given variables: index, caldataload[index], calldatasize
Or(calldataload[index] == 0, index < calldatasize)

Good first issue

This issue is labeled as a good first issue. Hop by on our discord server if you’d like to contribute!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
nbanmpcommented, Oct 19, 2018
0reactions
gitcoinbotcommented, Oct 25, 2018

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


The funding of 0.6 ETH (122.81 USD @ $204.68/ETH) attached to this issue has been approved & issued to @nbanmp.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ethereum in Depth, Part 2 - OpenZeppelin blog
CALLDATASIZE tells the size of the transaction data. CALLDATALOAD loads 32 bytes of the transaction data onto the stack. CALLDATACOPY copies a ...
Read more >
Inline Assembly — Solidity 0.8.17 documentation
Inline Assembly . You can interleave Solidity statements with inline assembly in a language close to the one of the Ethereum Virtual...
Read more >
Calldatasize constraints | consensys Funded Issue Detail | Gitcoin ...
When there is a constraint on some ```calldata[x] != 0``` then there should be a constraint that the ```calldatasize > x``` Take the...
Read more >
Meteor.call data size constraints? - help
I'm using peerlibrary:metor-file in my application to read in fles using the HTML5 handler. Afterwards, I want to push them to the server ......
Read more >
Optimizer: Function Constraint Summarizer · Issue #10809
... we need to know constraints on the return values of some builtin functions: calldatasize cannot be too large, address is also bounded ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found