Skip to content

Commit c1a57ff

Browse files
author
Martin Blicha
committed
[SMTChecker] More precise creation of verification targets.
1 parent be02db4 commit c1a57ff

39 files changed

+237
-215
lines changed

Changelog.md

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Bugfixes:
1010
* SMTChecker: Fix internal error on conversion from string literal to byte.
1111
* SMTChecker: Fix internal error when using tuples of rational literals inside the conditional operator.
1212
* SMTChecker: Fix internal error when assigning state variable via contract's name.
13+
* SMTChecker: Fix incorrect counterexamples reported by the CHC engine.
14+
* SMTChecker: Fix false negative in modifier applied multiple times.
1315
* Code generator: Fix missing creation dependency tracking for abstract contracts.
1416

1517

docs/security-considerations.rst

+21-7
Original file line numberDiff line numberDiff line change
@@ -620,33 +620,47 @@ types.
620620

621621
// SPDX-License-Identifier: GPL-3.0
622622
pragma solidity >=0.5.0;
623+
pragma experimental ABIEncoderV2;
623624
pragma experimental SMTChecker;
624625
// This will report a warning
625626

626627
contract Aliasing
627628
{
628-
uint[] array;
629+
uint[] array1;
630+
uint[][] array2;
629631
function f(
630632
uint[] memory a,
631633
uint[] memory b,
632634
uint[][] memory c,
633635
uint[] storage d
634-
) internal view {
635-
require(array[0] == 42);
636-
require(a[0] == 2);
637-
require(c[0][0] == 2);
638-
require(d[0] == 2);
636+
) internal {
637+
array1[0] = 42;
638+
a[0] = 2;
639+
c[0][0] = 2;
639640
b[0] = 1;
640641
// Erasing knowledge about memory references should not
641642
// erase knowledge about state variables.
642-
assert(array[0] == 42);
643+
assert(array1[0] == 42);
644+
// However, an assignment to a storage reference will erase
645+
// storage knowledge accordingly.
646+
d[0] = 2;
647+
// Fails as false positive because of the assignment above.
648+
assert(array1[0] == 42);
643649
// Fails because `a == b` is possible.
644650
assert(a[0] == 2);
645651
// Fails because `c[i] == b` is possible.
646652
assert(c[0][0] == 2);
647653
assert(d[0] == 2);
648654
assert(b[0] == 1);
649655
}
656+
function g(
657+
uint[] memory a,
658+
uint[] memory b,
659+
uint[][] memory c,
660+
uint x
661+
) public {
662+
f(a, b, c, array2[x]);
663+
}
650664
}
651665

652666
After the assignment to ``b[0]``, we need to clear knowledge about ``a`` since

0 commit comments

Comments
 (0)