forked from microsoft/verisol
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb40049
commit aeec19d
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
pragma solidity >=0.4.24<0.6.0; | ||
|
||
contract MapInitTest1 { | ||
mapping (uint256 => uint256) public recoverMap1; | ||
|
||
constructor(uint256 owner, uint256 key) | ||
public | ||
{ | ||
require(owner != 0); | ||
recoverMap1[key] = owner; | ||
} | ||
|
||
function test(uint256 key) | ||
external | ||
{ | ||
uint256 owner1 = recoverMap1[key]; | ||
uint256 owner2 = recoverMap1[key + 1]; | ||
require(owner1 != 0); | ||
|
||
assert(owner1 != owner2); | ||
} | ||
} | ||
|
||
contract MapInitTest2 { | ||
mapping (uint256 => mapping (uint256 => uint256)) public recoverMap2; | ||
|
||
constructor(uint256 owner, uint256 key1, uint256 key2) | ||
public | ||
{ | ||
require(owner != 0); | ||
recoverMap2[key1][key2] = owner; | ||
} | ||
|
||
function test(uint256 key1, uint256 key2) | ||
external | ||
{ | ||
uint256 owner1 = recoverMap2[key1][key2]; | ||
uint256 owner2 = recoverMap2[key1][key2 + 1]; | ||
require(owner1 != 0); | ||
|
||
assert(owner1 != owner2); // <--- false positive corral runs | ||
} | ||
} | ||
|
aeec19d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
microsoft#188