Git Product home page Git Product logo

Comments (4)

inian avatar inian commented on September 13, 2024

Hey, oyente flags this as a bug because in theory beneficiary can call itself recursively to exceed the callstack limit, run out of gas etc. and throw an exception. The recommended way to handle this, is to refactor the code to as follows or use the more safer transfer function -

pragma solidity ^0.4.11;
contract Foo {
  address public beneficiary = msg.sender;

  function withdraw() public
  returns (bool success)
  {
    if (msg.sender != beneficiary) {
      throw;
    }
    if(!beneficiary.call.value(this.balance)()) {
        throw;
    }
    return true;
  }

  function ()
  payable
  {
  }
}

from oyente.

baibaratsky avatar baibaratsky commented on September 13, 2024

Well, it was the first thing I tried before open this issue, and it also causes Callstack Attack: True.

For sure I know that beneficiary could make recursive calls to exceed the callstack limit, but in this case it doesn’t affect anything, no?

from oyente.

inian avatar inian commented on September 13, 2024

Hey, can u try again with the latest version of the code? I modified the callstack detection logic in a recent commit :)

Yes, as you said it cannot be exploited in this case (since it is the last statement).

from oyente.

baibaratsky avatar baibaratsky commented on September 13, 2024

Sorry, can’t check. I use a web version (which is not the latest one, I suppose).
Docker container doesn‘t work for me:

# cd /oyente && python oyente.py -s foo.sol 
WARNING:root:You are using evm version 1.6.5. The supported version is 1.6.1
WARNING:root:You are using solc version 0.4.12, The supported version is 0.4.10
CRITICAL:root:Solidity compilation failed

from oyente.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.