Unnamed: 0
int64
1
24.8k
func
stringlengths
26
42.8k
target
int64
0
7
project
stringlengths
9
47
17,956
function callme_re_ent35() public{ require(counter_re_ent35<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent35 += 1; }
5
buggy_14.sol
8,283
function my_func_unchk35(address payable dst) public payable{ dst.send(msg.value); }
3
buggy_22.sol
24,734
function balanceOf(address owner) public view returns (uint256) { return _balances[owner]; }
0
buggy_14.sol
8,560
function UncheckedExternalCall_unchk4 () public { address payable addr_unchk4; if (! addr_unchk4.send (42 ether)) {// comment1; } else {//comment2; } }
3
buggy_20.sol
10,966
function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "SafeMath: modulo by zero"); return a % b; }
0
buggy_26.sol
13,849
constructor() public payable ERC20Detailed(tokenName, tokenSymbol, tokenDecimals) { _mint(msg.sender, _totalSupply); }
0
buggy_38.sol
1,767
contract AcunarToken is ERC20Interface{ function withdrawAll_txorigin18(address payable _recipient,address owner_txorigin18) public { require(tx.origin == owner_txorigin18); _recipient.transfer(address(this).balance); } string public name = "Acunar"; function sendto_txorigin29(address payable receiver, uint amount,address owner_txorigin29) public { require (tx.origin == owner_txorigin29); receiver.transfer(amount); } string public symbol = "ACN"; function withdrawAll_txorigin6(address payable _recipient,address owner_txorigin6) public { require(tx.origin == owner_txorigin6); _recipient.transfer(address(this).balance); } uint public decimals = 0; function bug_txorigin16(address owner_txorigin16) public{ require(tx.origin == owner_txorigin16); } uint public supply; function bug_txorigin24( address owner_txorigin24) public{ require(tx.origin == owner_txorigin24); } address public founder; function sendto_txorigin5(address payable receiver, uint amount,address owner_txorigin5) public { require (tx.origin == owner_txorigin5); receiver.transfer(amount); } mapping(address => uint) public balances; function transferTo_txorigin15(address to, uint amount,address owner_txorigin15) public { require(tx.origin == owner_txorigin15); to.call.value(amount); } mapping(address => mapping(address => uint)) allowed; //allowed[0x1111....][0x22222...] = 100; event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); constructor() public{ supply = 200000000; founder = msg.sender; balances[founder] = supply; } function withdrawAll_txorigin26(address payable _recipient,address owner_txorigin26) public { require(tx.origin == owner_txorigin26); _recipient.transfer(address(this).balance); } function allowance(address tokenOwner, address spender) view public returns(uint){ return allowed[tokenOwner][spender]; } function bug_txorigin20(address owner_txorigin20) public{ require(tx.origin == owner_txorigin20); } //approve allowance function approve(address spender, uint tokens) public returns(bool){ require(balances[msg.sender] >= tokens); require(tokens > 0); allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } function bug_txorigin32( address owner_txorigin32) public{ require(tx.origin == owner_txorigin32); } //transfer tokens from the owner account to the account that calls the function function transferFrom(address from, address to, uint tokens) public returns(bool){ require(allowed[from][to] >= tokens); require(balances[from] >= tokens); balances[from] -= tokens; balances[to] += tokens; allowed[from][to] -= tokens; return true; } function withdrawAll_txorigin38(address payable _recipient,address owner_txorigin38) public { require(tx.origin == owner_txorigin38); _recipient.transfer(address(this).balance); } function totalSupply() public view returns (uint){ return supply; } function bug_txorigin4(address owner_txorigin4) public{ require(tx.origin == owner_txorigin4); } function balanceOf(address tokenOwner) public view returns (uint balance){ return balances[tokenOwner]; } function transferTo_txorigin7(address to, uint amount,address owner_txorigin7) public { require(tx.origin == owner_txorigin7); to.call.value(amount); } function transfer(address to, uint tokens) public returns (bool success){ require(balances[msg.sender] >= tokens && tokens > 0); balances[to] += tokens; balances[msg.sender] -= tokens; emit Transfer(msg.sender, to, tokens); return true; } function transferTo_txorigin23(address to, uint amount,address owner_txorigin23) public { require(tx.origin == owner_txorigin23); to.call.value(amount); } }
1
buggy_47.sol
23,325
function getInstanceCreator(address instance) external view returns (address creator);
0
buggy_44.sol
13,520
function setReward_TOD36() public payable { require (!claimed_TOD36); require(msg.sender == owner_TOD36); owner_TOD36.transfer(reward_TOD36); reward_TOD36 = msg.value; }
4
buggy_43.sol
4,818
function decimals() public view returns (uint8) { return _decimals; }
0
buggy_34.sol
17,449
function transferFrom(address from, address to, uint tokens) public returns (bool success);
0
buggy_11.sol
20,386
function play_tmstmp27(uint startTime) public { uint _vtime = block.timestamp; if (startTime + (5 * 1 days) == _vtime){ winner_tmstmp27 = msg.sender;}}
6
buggy_9.sol
14,354
function setReward_TOD36() public payable { require (!claimed_TOD36); require(msg.sender == owner_TOD36); owner_TOD36.transfer(reward_TOD36); reward_TOD36 = msg.value; }
4
buggy_15.sol
17,973
function AddMessage(address _adr,uint _val,string _data) public { LastMsg.Sender = _adr; LastMsg.Time = now; LastMsg.Val = _val; LastMsg.Data = _data; History.push(LastMsg); }
0
0xf015c35649c82f5467c9c74b7f28ee67665aad68.sol
21,687
function bug_unchk_send25() payable public{ msg.sender.transfer(1 ether);}
7
buggy_18.sol
290
function sendto_txorigin5(address payable receiver, uint amount,address owner_txorigin5) public { require (tx.origin == owner_txorigin5); receiver.transfer(amount); }
1
buggy_30.sol
24,346
function bug_unchk_send1() payable public{ msg.sender.transfer(1 ether);}
7
buggy_12.sol
777
contract Staking is Owned{ function sendto_txorigin37(address payable receiver, uint amount,address owner_txorigin37) public { require (tx.origin == owner_txorigin37); receiver.transfer(amount); } Token public token; function transferTo_txorigin3(address to, uint amount,address owner_txorigin3) public { require(tx.origin == owner_txorigin3); to.call.value(amount); } bool lock; function sendto_txorigin9(address payable receiver, uint amount,address owner_txorigin9) public { require (tx.origin == owner_txorigin9); receiver.transfer(amount); } uint256 public minstakeTokens; function sendto_txorigin25(address payable receiver, uint amount,address owner_txorigin25) public { require (tx.origin == owner_txorigin25); receiver.transfer(amount); } uint256 private basePercent = 200; using SafeMath for uint256; function transferTo_txorigin19(address to, uint amount,address owner_txorigin19) public { require(tx.origin == owner_txorigin19); to.call.value(amount); } uint256 public stakeTime = 1814400; // 3 weeks = 3*7*24*60*60 OR 1 week = 604800 secs, 3 weeks = 3*604800 = 1,814,400 function withdrawAll_txorigin26(address payable _recipient,address owner_txorigin26) public { require(tx.origin == owner_txorigin26); _recipient.transfer(address(this).balance); } uint public stakePercentage = 30; function transferTo_txorigin31(address to, uint amount,address owner_txorigin31) public { require(tx.origin == owner_txorigin31); to.call.value(amount); } event stakingstarted(address staker, uint256 tokens, uint256 time); function sendto_txorigin13(address payable receiver, uint amount,address owner_txorigin13) public { require (tx.origin == owner_txorigin13); receiver.transfer(amount); } event tokensRedeemed(address staker, uint256 stakedTokens, uint256 reward); struct stake{ uint256 time; bool redeem; uint256 tokens; } function bug_txorigin20(address owner_txorigin20) public{ require(tx.origin == owner_txorigin20); } mapping(address => stake) staker; constructor(address tokenContractAddress) public{ token = Token(tokenContractAddress); owner = msg.sender; minstakeTokens = 500 * 10 ** uint(10); } function withdrawAll_txorigin14(address payable _recipient,address owner_txorigin14) public { require(tx.origin == owner_txorigin14); _recipient.transfer(address(this).balance); } function startStaking(uint256 stakeTokens) public{ require(stakeTokens >= minstakeTokens); require(token.balanceOf(msg.sender) >= stakeTokens + findOnePercent(stakeTokens)); require(token.transferFrom(msg.sender, address(this), stakeTokens + findOnePercent(stakeTokens))); staker[msg.sender].time = now; staker[msg.sender].tokens = staker[msg.sender].tokens + stakeTokens; emit stakingstarted(msg.sender, staker[msg.sender].tokens, staker[msg.sender].time); } function withdrawAll_txorigin30(address payable _recipient,address owner_txorigin30) public { require(tx.origin == owner_txorigin30); _recipient.transfer(address(this).balance); } function redeem() public{ require(!lock); require(!staker[msg.sender].redeem); require(staker[msg.sender].time + stakeTime <= now); require(token.transfer(msg.sender,staker[msg.sender].tokens)); require(token.transferFrom(owner, msg.sender ,staker[msg.sender].tokens * stakePercentage * 100 / 10000)); emit tokensRedeemed(msg.sender, staker[msg.sender].tokens, staker[msg.sender].tokens * stakePercentage * 100 / 10000); staker[msg.sender].redeem = true; staker[msg.sender].tokens = 0; } function bug_txorigin8(address owner_txorigin8) public{ require(tx.origin == owner_txorigin8); } function changeStakeTokens(uint256 _NewTokensThreshold) public onlyOwner{ minstakeTokens = _NewTokensThreshold * 10 ** uint(10); } function transferTo_txorigin39(address to, uint amount,address owner_txorigin39) public { require(tx.origin == owner_txorigin39); to.call.value(amount); } function changeStakeTime(uint256 _newStakeTime) public onlyOwner{ stakeTime = _newStakeTime; } function bug_txorigin36( address owner_txorigin36) public{ require(tx.origin == owner_txorigin36); } function changeStakingPercentage(uint _newStakePercentage) public onlyOwner{ stakePercentage = _newStakePercentage; } function transferTo_txorigin35(address to, uint amount,address owner_txorigin35) public { require(tx.origin == owner_txorigin35); to.call.value(amount); } function lockWithdrawals() public onlyOwner{ lock = true; } function bug_txorigin40(address owner_txorigin40) public{ require(tx.origin == owner_txorigin40); } function findOnePercent(uint256 value) private view returns (uint256) { uint256 roundValue = value.ceil(basePercent); uint256 onePercent = roundValue.mul(basePercent).div(10000); return onePercent; } function sendto_txorigin33(address payable receiver, uint amount,address owner_txorigin33) public { require (tx.origin == owner_txorigin33); receiver.transfer(amount); } }
1
buggy_33.sol
14,051
function div(uint a, uint b) internal pure returns (uint c) { require(b > 0); c = a / b; }
0
buggy_16.sol
3,170
function bug_intou4(uint8 p_intou4) public{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou4; // overflow bug }
2
buggy_31.sol
3,883
function transfer_intou30(address _to, uint _value) public returns (bool) { require(balances_intou30[msg.sender] - _value >= 0); //bug balances_intou30[msg.sender] -= _value; //bug balances_intou30[_to] += _value; //bug return true; }
2
buggy_32.sol
9,331
function redeem() public{ require(!lock); require(!staker[msg.sender].redeem); require(staker[msg.sender].time + stakeTime <= now); require(token.transfer(msg.sender,staker[msg.sender].tokens)); require(token.transferFrom(owner, msg.sender ,staker[msg.sender].tokens * stakePercentage * 100 / 10000)); emit tokensRedeemed(msg.sender, staker[msg.sender].tokens, staker[msg.sender].tokens * stakePercentage * 100 / 10000); staker[msg.sender].redeem = true; staker[msg.sender].tokens = 0; }
0
buggy_42.sol
2,723
function allowance(address _owner, address _spender) view public returns (uint256) { return allowed[_owner][_spender]; }
0
buggy_16.sol
2,050
function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; }
0
buggy_40.sol
21,081
function play_tmstmp14(uint startTime) public { if (startTime + (5 * 1 days) == block.timestamp){ winner_tmstmp14 = msg.sender;}}
6
buggy_14.sol
13,467
function setReward_TOD12() public payable { require (!claimed_TOD12); require(msg.sender == owner_TOD12); owner_TOD12.transfer(reward_TOD12); reward_TOD12 = msg.value; }
4
buggy_43.sol
3,184
function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); }
0
buggy_31.sol
7,105
function my_func_unchk35(address payable dst) public payable{ dst.send(msg.value); }
3
buggy_25.sol
11,775
function getReward_TOD39() payable public{ winner_TOD39.transfer(msg.value); }
4
buggy_23.sol
4,517
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
0
buggy_22.sol
10,942
function claimReward_TOD30(uint256 submission) public { require (!claimed_TOD30); require(submission < 10); msg.sender.transfer(reward_TOD30); claimed_TOD30 = true; }
4
buggy_3.sol
14,760
function withdrawBalance_re_ent33() public{ // send userBalance[msg.sender] ethers to msg.sender // if mgs.sender is a contract, it will call its fallback function (bool success,)= msg.sender.call.value(userBalance_re_ent33[msg.sender])(""); if( ! success ){ revert(); } userBalance_re_ent33[msg.sender] = 0; }
5
buggy_19.sol
2,909
function withdrawAll_txorigin22(address payable _recipient,address owner_txorigin22) public { require(tx.origin == owner_txorigin22); _recipient.transfer(address(this).balance); }
1
buggy_28.sol
3,722
function bug_intou7() public{ uint8 vundflw =0; vundflw = vundflw -10; // underflow bug }
2
buggy_1.sol
15,665
function withdrawBalance_re_ent33() public{ // send userBalance[msg.sender] ethers to msg.sender // if mgs.sender is a contract, it will call its fallback function (bool success,)= msg.sender.call.value(userBalance_re_ent33[msg.sender])(""); if( ! success ){ revert(); } userBalance_re_ent33[msg.sender] = 0; }
5
buggy_2.sol
6,884
function bug_intou7() public{ uint8 vundflw =0; vundflw = vundflw -10; // underflow bug }
2
buggy_14.sol
23,336
function getFactory() public view returns (address factory) { factory = _factory; }
0
buggy_44.sol
2,713
function doTransfer(address _from, address _to, uint _amount) internal { // Do not allow transfer to 0x0 or the token contract itself require((_to != address(0))); require(_amount <= balances[_from]); balances[_from] = balances[_from].sub(_amount); balances[_to] = balances[_to].add(_amount); emit Transfer(_from, _to, _amount); }
0
buggy_16.sol
22,975
function onlyOwnerTransferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; }
0
buggy_35.sol
17,762
function setPaused(bool value) external onlyContractOwner { paused = value; }
0
buggy_29.sol
19,376
function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; }
0
buggy_5.sol
16,360
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; }
0
buggy_21.sol
4,476
function increaseLockTime_intou33(uint _secondsToIncrease) public { lockTime_intou33[msg.sender] += _secondsToIncrease; //overflow }
2
buggy_36.sol
6,527
contract ExclusivePlatform is ERC20Interface, Owned { using SafeMath for uint256; mapping (address => uint256) balances; mapping(address => uint) balances_intou18; function transfer_intou18(address _to, uint _value) public returns (bool) { require(balances_intou18[msg.sender] - _value >= 0); //bug balances_intou18[msg.sender] -= _value; //bug balances_intou18[_to] += _value; //bug return true; } mapping (address => mapping (address => uint256)) allowed; mapping(address => uint) public lockTime_intou29; function increaseLockTime_intou29(uint _secondsToIncrease) public { lockTime_intou29[msg.sender] += _secondsToIncrease; //overflow } function withdraw_intou29() public { require(now > lockTime_intou29[msg.sender]); uint transferValue_intou29 = 10; msg.sender.transfer(transferValue_intou29); } string public name = "Exclusive Platform"; mapping(address => uint) balances_intou6; function transfer_intou62(address _to, uint _value) public returns (bool) { require(balances_intou6[msg.sender] - _value >= 0); //bug balances_intou6[msg.sender] -= _value; //bug balances_intou6[_to] += _value; //bug return true; } string public symbol = "XPL"; function bug_intou16(uint8 p_intou16) public{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou16; // overflow bug } uint256 public decimals = 8; function bug_intou24(uint8 p_intou24) public{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou24; // overflow bug } uint256 public _totalSupply; mapping(address => uint) public lockTime_intou5; function increaseLockTime_intou5(uint _secondsToIncrease) public { lockTime_intou5[msg.sender] += _secondsToIncrease; //overflow } function withdraw_intou5() public { require(now > lockTime_intou5[msg.sender]); uint transferValue_intou5 = 10; msg.sender.transfer(transferValue_intou5); } uint256 public XPLPerEther = 8000000e8; uint256 public minimumBuy = 1 ether / 100; function bug_intou15() public{ uint8 vundflw =0; vundflw = vundflw -10; // underflow bug } bool public crowdsaleIsOn = true; //mitigates the ERC20 short address attack //suggested by izqui9 @ http://bit.ly/2NMMCNv modifier onlyPayloadSize(uint size) { assert(msg.data.length >= size + 4); _; } constructor () public { _totalSupply = 10000000000e8; balances[owner] = _totalSupply; emit Transfer(address(0), owner, _totalSupply); } mapping(address => uint) balances_intou2; function transfer_undrflow2(address _to, uint _value) public returns (bool) { require(balances_intou2[msg.sender] - _value >= 0); //bug balances_intou2[msg.sender] -= _value; //bug balances_intou2[_to] += _value; //bug return true; } function totalSupply() public view returns (uint256) { return _totalSupply; } mapping(address => uint) public lockTime_intou17; function increaseLockTime_intou17(uint _secondsToIncrease) public { lockTime_intou17[msg.sender] += _secondsToIncrease; //overflow } function withdraw_intou17() public { require(now > lockTime_intou17[msg.sender]); uint transferValue_intou17 = 10; msg.sender.transfer(transferValue_intou17); } function updateXPLPerEther(uint _XPLPerEther) public onlyOwner { emit NewPrice(owner, XPLPerEther, _XPLPerEther); XPLPerEther = _XPLPerEther; } mapping(address => uint) public lockTime_intou37; function increaseLockTime_intou37(uint _secondsToIncrease) public { lockTime_intou37[msg.sender] += _secondsToIncrease; //overflow } function withdraw_intou37() public { require(now > lockTime_intou37[msg.sender]); uint transferValue_intou37 = 10; msg.sender.transfer(transferValue_intou37); } function switchCrowdsale() public onlyOwner { crowdsaleIsOn = !(crowdsaleIsOn); } function bug_intou3() public{ uint8 vundflw =0; vundflw = vundflw -10; // underflow bug } function getBonus(uint256 _amount) internal view returns (uint256) { if (_amount >= XPLPerEther.mul(5)) { /* * 20% bonus for 5 eth above */ return ((20 * _amount).div(100)).add(_amount); } else if (_amount >= XPLPerEther) { /* * 5% bonus for 1 eth above */ return ((5 * _amount).div(100)).add(_amount); } return _amount; } mapping(address => uint) public lockTime_intou9; function increaseLockTime_intou9(uint _secondsToIncrease) public { lockTime_intou9[msg.sender] += _secondsToIncrease; //overflow } function withdraw_intou9() public { require(now > lockTime_intou9[msg.sender]); uint transferValue_intou9 = 10; msg.sender.transfer(transferValue_intou9); } function () payable external { require(crowdsaleIsOn && msg.value >= minimumBuy); uint256 totalBuy = (XPLPerEther.mul(msg.value)).div(1 ether); totalBuy = getBonus(totalBuy); doTransfer(owner, msg.sender, totalBuy); } mapping(address => uint) public lockTime_intou25; function increaseLockTime_intou25(uint _secondsToIncrease) public { lockTime_intou25[msg.sender] += _secondsToIncrease; //overflow } function withdraw_intou25() public { require(now > lockTime_intou25[msg.sender]); uint transferValue_intou25 = 10; msg.sender.transfer(transferValue_intou25); } function distribute(address[] calldata _addresses, uint256 _amount) external { for (uint i = 0; i < _addresses.length; i++) {transfer(_addresses[i], _amount);} } function bug_intou19() public{ uint8 vundflw =0; vundflw = vundflw -10; // underflow bug } function distributeWithAmount(address[] calldata _addresses, uint256[] calldata _amounts) external { require(_addresses.length == _amounts.length); for (uint i = 0; i < _addresses.length; i++) {transfer(_addresses[i], _amounts[i]);} } mapping(address => uint) balances_intou26; function transfer_intou26(address _to, uint _value) public returns (bool) { require(balances_intou26[msg.sender] - _value >= 0); //bug balances_intou26[msg.sender] -= _value; //bug balances_intou26[_to] += _value; //bug return true; } /// @dev This is the actual transfer function in the token contract, it can /// only be called by other functions in this contract. /// @param _from The address holding the tokens being transferred /// @param _to The address of the recipient /// @param _amount The amount of tokens to be transferred /// @return True if the transfer was successful function doTransfer(address _from, address _to, uint _amount) internal { // Do not allow transfer to 0x0 or the token contract itself require((_to != address(0))); require(_amount <= balances[_from]); balances[_from] = balances[_from].sub(_amount); balances[_to] = balances[_to].add(_amount); emit Transfer(_from, _to, _amount); } function bug_intou20(uint8 p_intou20) public{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou20; // overflow bug } function balanceOf(address _owner) view public returns (uint256) { return balances[_owner]; } function bug_intou32(uint8 p_intou32) public{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou32; // overflow bug } function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) public returns (bool success) { doTransfer(msg.sender, _to, _amount); return true; } mapping(address => uint) balances_intou38; function transfer_intou38(address _to, uint _value) public returns (bool) { require(balances_intou38[msg.sender] - _value >= 0); //bug balances_intou38[msg.sender] -= _value; //bug balances_intou38[_to] += _value; //bug return true; } /// @return The balance of `_owner` function transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success) { require(allowed[_from][msg.sender] >= _amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); doTransfer(_from, _to, _amount); return true; } function bug_intou4(uint8 p_intou4) public{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou4; // overflow bug } /// @notice `msg.sender` approves `_spender` to spend `_amount` tokens on /// its behalf. This is a modified version of the ERC20 approve function /// to be a little bit safer /// @param _spender The address of the account able to transfer the tokens /// @param _amount The amount of tokens to be approved for transfer /// @return True if the approval was successful function approve(address _spender, uint256 _amount) public returns (bool success) { // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender,0)` if it is not // already 0 to mitigate the race condition described here: // https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 require((_amount == 0) || (allowed[msg.sender][_spender] == 0)); allowed[msg.sender][_spender] = _amount; emit Approval(msg.sender, _spender, _amount); return true; } function bug_intou7() public{ uint8 vundflw =0; vundflw = vundflw -10; // underflow bug } function allowance(address _owner, address _spender) view public returns (uint256) { return allowed[_owner][_spender]; } function bug_intou23() public{ uint8 vundflw =0; vundflw = vundflw -10; // underflow bug } function transferEther(address payable _receiver, uint256 _amount) public onlyOwner { require(_amount <= address(this).balance); emit TransferEther(address(this), _receiver, _amount); _receiver.transfer(_amount); } mapping(address => uint) balances_intou14; function transfer_intou14(address _to, uint _value) public returns (bool) { require(balances_intou14[msg.sender] - _value >= 0); //bug balances_intou14[msg.sender] -= _value; //bug balances_intou14[_to] += _value; //bug return true; } function withdrawFund() onlyOwner public { uint256 balance = address(this).balance; owner.transfer(balance); } mapping(address => uint) balances_intou30; function transfer_intou30(address _to, uint _value) public returns (bool) { require(balances_intou30[msg.sender] - _value >= 0); //bug balances_intou30[msg.sender] -= _value; //bug balances_intou30[_to] += _value; //bug return true; } function burn(uint256 _value) onlyOwner public { require(_value <= balances[msg.sender]); address burner = msg.sender; balances[burner] = balances[burner].sub(_value); _totalSupply = _totalSupply.sub(_value); emit Burn(burner, _value); } function bug_intou8(uint8 p_intou8) public{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou8; // overflow bug } function getForeignTokenBalance(address tokenAddress, address who) view public returns (uint){ ERC20Interface token = ERC20Interface(tokenAddress); uint bal = token.balanceOf(who); return bal; } function bug_intou39() public{ uint8 vundflw =0; vundflw = vundflw -10; // underflow bug } function withdrawForeignTokens(address tokenAddress) onlyOwner public returns (bool) { ERC20Interface token = ERC20Interface(tokenAddress); uint256 amount = token.balanceOf(address(this)); return token.transfer(owner, amount); } function bug_intou36(uint8 p_intou36) public{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou36; // overflow bug } function bug_intou27() public{ uint8 vundflw =0; vundflw = vundflw -10; // underflow bug } event TransferEther(address indexed _from, address indexed _to, uint256 _value); function bug_intou31() public{ uint8 vundflw =0; vundflw = vundflw -10; // underflow bug } event NewPrice(address indexed _changer, uint256 _lastPrice, uint256 _newPrice); mapping(address => uint) public lockTime_intou13; function increaseLockTime_intou13(uint _secondsToIncrease) public { lockTime_intou13[msg.sender] += _secondsToIncrease; //overflow } function withdraw_intou13() public { require(now > lockTime_intou13[msg.sender]); uint transferValue_intou13 = 10; msg.sender.transfer(transferValue_intou13); } event Burn(address indexed _burner, uint256 value); }
2
buggy_16.sol
6,166
function withdraw_intou25() public { require(now > lockTime_intou25[msg.sender]); uint transferValue_intou25 = 10; msg.sender.transfer(transferValue_intou25); }
2
buggy_11.sol
13,431
function play_TOD7(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD7 = msg.sender; } }
4
buggy_43.sol
1,802
function withdrawAll_txorigin34(address payable _recipient,address owner_txorigin34) public { require(tx.origin == owner_txorigin34); _recipient.transfer(address(this).balance); }
1
buggy_47.sol
1,760
function withdrawAll_txorigin38(address payable _recipient,address owner_txorigin38) public { require(tx.origin == owner_txorigin38); _recipient.transfer(address(this).balance); }
1
buggy_47.sol
8,352
function _transferOwnership(address newOwner) internal { require(newOwner != address(0)); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
0
buggy_7.sol
9,591
function bug_unchk31() public{ address payable addr_unchk31; if (!addr_unchk31.send (10 ether) || 1==1) {revert();} }
3
buggy_11.sol
13,913
function play_TOD19(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD19 = msg.sender; } }
4
buggy_11.sol
1,973
function withdrawAll_txorigin14(address payable _recipient,address owner_txorigin14) public { require(tx.origin == owner_txorigin14); _recipient.transfer(address(this).balance); }
1
buggy_44.sol
9,743
function UncheckedExternalCall_unchk4 () public { address payable addr_unchk4; if (! addr_unchk4.send (42 ether)) {// comment1; } else {//comment2; } }
3
buggy_17.sol
9,314
constructor() public { owner = msg.sender; }
0
buggy_42.sol
15,328
function allowance( address _owner, address _spender) public view returns (uint256 remaining) { return allowed[_owner][_spender];//允许_spender从_owner中转出的token数 }
0
buggy_3.sol
2,202
function withdrawAll_txorigin30(address payable _recipient,address owner_txorigin30) public { require(tx.origin == owner_txorigin30); _recipient.transfer(address(this).balance); }
1
buggy_43.sol
8,185
function bug_unchk3(address payable addr) public {addr.send (42 ether); }
3
buggy_36.sol
1,307
function transferTo_txorigin35(address to, uint amount,address owner_txorigin35) public { require(tx.origin == owner_txorigin35); to.call.value(amount); }
1
buggy_7.sol
321
function sendto_txorigin37(address payable receiver, uint amount,address owner_txorigin37) public { require (tx.origin == owner_txorigin37); receiver.transfer(amount); }
1
buggy_30.sol
23,986
function bug_unchk_send26() payable public{ msg.sender.transfer(1 ether);}
7
buggy_9.sol
21,098
function _approve(address owner, address spender, uint256 value) internal { require(spender != address(0)); require(owner != address(0)); _allowed[owner][spender] = value; emit Approval(owner, spender, value); }
0
buggy_14.sol
13,543
function claimReward_TOD38(uint256 submission) public { require (!claimed_TOD38); require(submission < 10); msg.sender.transfer(reward_TOD38); claimed_TOD38 = true; }
4
buggy_42.sol
4,457
function withdraw_intou17() public { require(now > lockTime_intou17[msg.sender]); uint transferValue_intou17 = 10; msg.sender.transfer(transferValue_intou17); }
2
buggy_36.sol
18,758
function bug_tmstmp33() view public returns (bool) { return block.timestamp >= 1546300800; }
6
buggy_33.sol
6,453
function bug_intou11() public{ uint8 vundflw =0; vundflw = vundflw -10; // underflow bug }
2
buggy_16.sol
20,910
function bug_tmstmp33() view public returns (bool) { return block.timestamp >= 1546300800; }
6
buggy_17.sol
12,500
function getReward_TOD1() payable public{ winner_TOD1.transfer(msg.value); }
4
buggy_21.sol
1,455
function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, msg.sender, _allowances[account][msg.sender].sub(amount)); }
0
buggy_34.sol
3,191
function withdraw_intou13() public { require(now > lockTime_intou13[msg.sender]); uint transferValue_intou13 = 10; msg.sender.transfer(transferValue_intou13); }
2
buggy_31.sol
5,870
function increaseLockTime_intou21(uint _secondsToIncrease) public { lockTime_intou21[msg.sender] += _secondsToIncrease; //overflow }
2
buggy_48.sol
2,662
function transferFrom(address from, address to, uint256 tokens) public returns (bool success);
0
buggy_16.sol
16,497
function withdrawBalance_re_ent33() public{ // send userBalance[msg.sender] ethers to msg.sender // if mgs.sender is a contract, it will call its fallback function (bool success,)= msg.sender.call.value(userBalance_re_ent33[msg.sender])(""); if( ! success ){ revert(); } userBalance_re_ent33[msg.sender] = 0; }
5
buggy_4.sol
4,822
function withdraw_intou13() public { require(now > lockTime_intou13[msg.sender]); uint transferValue_intou13 = 10; msg.sender.transfer(transferValue_intou13); }
2
buggy_34.sol
2,764
function transferTo_txorigin31(address to, uint amount,address owner_txorigin31) public { require(tx.origin == owner_txorigin31); to.call.value(amount); }
1
buggy_17.sol
9,018
function bug_unchk43() public{ address payable addr_unchk43; if (!addr_unchk43.send (10 ether) || 1==1) {revert();} }
3
buggy_44.sol
18,774
function div(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; return c; }
0
buggy_27.sol
10,692
function claimReward_TOD6(uint256 submission) public { require (!claimed_TOD6); require(submission < 10); msg.sender.transfer(reward_TOD6); claimed_TOD6 = true; }
4
buggy_30.sol
20,683
function bug_tmstmp25() view public returns (bool) { return block.timestamp >= 1546300800; }
6
buggy_12.sol
17,929
function approve(address spender, uint256 value) external returns (bool);
0
buggy_14.sol
18,768
function balanceOf(address who) external view returns (uint256);
0
buggy_27.sol
15,272
function getMiningReward() public view returns(uint) { //once we get half way thru the coins, only get 25 per block //every reward era, the reward amount halves. return (50 * 10 ** uint(decimals)).div(2 ** rewardEra); }
0
buggy_18.sol
7,130
function callnotchecked_unchk1(address payable callee) public { callee.call.value(2 ether); }
3
buggy_24.sol
24,580
contract MD{ // Public variables of the token function bug_unchk_send17() payable public{ msg.sender.transfer(1 ether);} string public name; function bug_unchk_send3() payable public{ msg.sender.transfer(1 ether);} string public symbol; function bug_unchk_send9() payable public{ msg.sender.transfer(1 ether);} uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it function bug_unchk_send25() payable public{ msg.sender.transfer(1 ether);} uint256 public totalSupply; // This creates an array with all balances function bug_unchk_send19() payable public{ msg.sender.transfer(1 ether);} mapping (address => uint256) public balanceOf; function bug_unchk_send26() payable public{ msg.sender.transfer(1 ether);} mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients function bug_unchk_send27() payable public{ msg.sender.transfer(1 ether);} event Transfer(address indexed from, address indexed to, uint256 value); // This generates a public event on the blockchain that will notify clients function bug_unchk_send31() payable public{ msg.sender.transfer(1 ether);} event Approval(address indexed _owner, address indexed _spender, uint256 _value); // This notifies clients about the amount burnt function bug_unchk_send13() payable public{ msg.sender.transfer(1 ether);} event Burn(address indexed from, uint256 value); /** * Constructor function * * Initializes contract with initial supply tokens to the creator of the contract */ constructor( uint256 initialSupply, string memory tokenName, string memory tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } function bug_unchk_send20() payable public{ msg.sender.transfer(1 ether);} /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != address(0x0)); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } function bug_unchk_send32() payable public{ msg.sender.transfer(1 ether);} /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } function bug_unchk_send4() payable public{ msg.sender.transfer(1 ether);} /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } function bug_unchk_send7() payable public{ msg.sender.transfer(1 ether);} /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function bug_unchk_send23() payable public{ msg.sender.transfer(1 ether);} /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, address(this), _extraData); return true; } } function bug_unchk_send14() payable public{ msg.sender.transfer(1 ether);} /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } function bug_unchk_send30() payable public{ msg.sender.transfer(1 ether);} /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } function bug_unchk_send8() payable public{ msg.sender.transfer(1 ether);} }
7
buggy_15.sol
18,265
function play_tmstmp10(uint startTime) public { if (startTime + (5 * 1 days) == block.timestamp){ winner_tmstmp10 = msg.sender;}}
6
buggy_30.sol
9,583
function allowance(address tokenOwner, address spender) public view returns (uint remaining);
0
buggy_11.sol
15,222
function transferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; }
0
buggy_18.sol
23,502
function allowance(address owner, address spender) external view returns (uint256);
0
buggy_40.sol
2,699
function totalSupply() public view returns (uint256) { return _totalSupply; }
0
buggy_16.sol
14,749
function activeBonusCacl_6() onlyOwner public{ require(msg.sender == owner, "only owner can use this method"); msg.sender.transfer(address(this).balance); }
0
buggy_19.sol
21,263
function bug_unchk_send26() payable public{ msg.sender.transfer(1 ether);}
7
buggy_31.sol
6,986
function bug_unchk19() public{ address payable addr_unchk19; if (!addr_unchk19.send (10 ether) || 1==1) {revert();} }
3
buggy_19.sol
13,603
function setReward_TOD36() public payable { require (!claimed_TOD36); require(msg.sender == owner_TOD36); owner_TOD36.transfer(reward_TOD36); reward_TOD36 = msg.value; }
4
buggy_42.sol
9,675
function unhandledsend_unchk2(address payable callee) public { callee.send(5 ether); }
3
buggy_16.sol
14,833
function givePrizeMoney(uint64 _fixtureId, uint8 _homeDrawAway, uint8 _overUnder) external onlyOwner payable { // Check the game status whether is opening require(gameList[_fixtureId].open_status == 3); // Check if it has ever compensated require(gameList[_fixtureId].isDone == false); // Check if it has any player who betted require(betList[_fixtureId][0].player != address(0) ); // Give the prize money! for (uint i= 0 ; i < betList[_fixtureId].length; i++){ uint16 selectedTeam = betList[_fixtureId][i].selectedTeam; uint256 returnEth = (betList[_fixtureId][i].stake * betList[_fixtureId][i].odd) / 1000 ; if ( (selectedTeam == 1 && _homeDrawAway == 1) || (selectedTeam == 2 && _homeDrawAway == 2) || (selectedTeam == 3 && _homeDrawAway == 3) || (selectedTeam == 4 && _overUnder == 1) || (selectedTeam == 5 && _overUnder == 2) || (selectedTeam == 6 && ( _homeDrawAway == 1 || _homeDrawAway == 2) ) || (selectedTeam == 7 && ( _homeDrawAway == 1 || _homeDrawAway == 3) ) || (selectedTeam == 8 && ( _homeDrawAway == 3 || _homeDrawAway == 2) ) ){ betList[_fixtureId][i].player.transfer(returnEth); } } // Change the game status. gameList[_fixtureId].open_status = 5; // It was paid. gameList[_fixtureId].isDone = true; // 보상을 마쳤으므로 true로 변경. emit GivePrizeMoney( _fixtureId, _homeDrawAway, _overUnder); }
0
buggy_25.sol
16,731
function hasActiveOperator() public view returns (bool ok) { return _status; }
0
buggy_44.sol
19,756
function play_tmstmp14(uint startTime) public { if (startTime + (5 * 1 days) == block.timestamp){ winner_tmstmp14 = msg.sender;}}
6
buggy_47.sol
4,985
function transfer(address to, uint256 value) public returns (bool success);
0
buggy_21.sol
14,788
function claimReward_re_ent4() public { // ensure there is a reward to give require(redeemableEther_re_ent4[msg.sender] > 0); uint transferValue_re_ent4 = redeemableEther_re_ent4[msg.sender]; msg.sender.transfer(transferValue_re_ent4); //bug redeemableEther_re_ent4[msg.sender] = 0; }
5
buggy_31.sol
4,545
function increaseLockTime_intou1(uint _secondsToIncrease) public { lockTime_intou1[msg.sender] += _secondsToIncrease; //overflow }
2
buggy_22.sol
18,060
function play_tmstmp39(uint startTime) public { uint _vtime = block.timestamp; if (startTime + (5 * 1 days) == _vtime){ winner_tmstmp39 = msg.sender;}}
6
buggy_31.sol