File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ library stdStorageSafe {
123
123
if (reads.length == 0 ) {
124
124
revert ("stdStorage find(StdStorage): No storage use detected for target. " );
125
125
} else {
126
- for (uint256 i = 0 ; i < reads.length ; i ++ ) {
126
+ for (uint256 i = reads.length ; -- i >= 0 ; ) {
127
127
bytes32 prev = vm.load (who, reads[i]);
128
128
if (prev == bytes32 (0 )) {
129
129
emit WARNING_UninitedSlot (who, uint256 (reads[i]));
Original file line number Diff line number Diff line change @@ -345,6 +345,11 @@ contract StdStorageTest is Test {
345
345
assertEq (retVal, vals[i]);
346
346
}
347
347
}
348
+
349
+ function testEdgeCaseArray () public {
350
+ stdstore.target (address (test)).sig ("edgeCaseArray(uint256) " ).with_key (uint256 (0 )).checked_write (1 );
351
+ assertEq (test.edgeCaseArray (0 ), 1 );
352
+ }
348
353
}
349
354
350
355
contract StorageTest {
@@ -378,6 +383,9 @@ contract StorageTest {
378
383
379
384
uint256 randomPacking;
380
385
386
+ // Array with length matching values of elements.
387
+ uint256 [] public edgeCaseArray = [3 , 3 , 3 ];
388
+
381
389
constructor () {
382
390
basic = UnpackedStruct ({a: 1337 , b: 1337 });
383
391
You can’t perform that action at this time.
0 commit comments