solidity icon indicating copy to clipboard operation
solidity copied to clipboard

Interesting case of dangling storage pointers

Open dddejan opened this issue 6 years ago • 0 comments
trafficstars

pragma solidity >=0.5.0;

contract DanglingStorage {
    int[][] baz;

    function() external payable {
        baz.length = 10;
        baz[0].length = 10;
        int x = baz[0][0];
        int[] storage bar = baz[0];
        baz.length = 0;
        int y = bar[0];
        assert(x == y);
    }
}

This Solidity code crashes because dereference when assigning y fails (I think). We need to clarify what's going on in this case.

dddejan avatar Oct 04 '19 00:10 dddejan