You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// SPDX-License-Identifier: MITpragma solidity0.8.17;
import {console, stdJson, Script} from"forge-std/Script.sol";
contractTestScriptisScript {
using stdJsonforstring;
function run() external {
stringmemory json = vm.readFile("test.json");
// This succeedsaddress[] memory tokens = json.readAddressArray(".tokens");
console.log("Tokens Length: %s", tokens.length);
// Every one of these causes panic
json.readAddressArray(".empty");
json.readBoolArray(".empty");
json.readBytesArray(".empty");
json.readBytes32Array(".empty");
json.readStringArray(".empty");
json.readIntArray(".empty");
json.readUintArray(".empty");
}
}
The application panicked (crashed).
Message: index out of bounds: the len is 0 but the index is 0
Location: evm/src/executor/inspector/cheatcodes/util.rs:133
This is a bug. Consider reporting it at https://github.com/foundry-rs/foundry
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1: __libc_start_call_main<unknown>
at ./csu/../sysdeps/nptl/libc_start_call_main.h:58
2: __libc_start_main_impl<unknown>
at ./csu/../csu/libc-start.c:392
Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
Aborted (core dumped)
Also worth noting that my local .env file contains the line COLORBT_SHOW_HIDDEN=1
The text was updated successfully, but these errors were encountered:
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (624797e 2023-02-20T00:07:44.723592254Z)
What command(s) is the bug in?
forge script
Operating System
Linux
Describe the bug
Empty arrays in JSON files cause a panic, when a corresponding
json.readTypeArray()
is called. Attaching a minimal example:Also worth noting that my local
.env
file contains the lineCOLORBT_SHOW_HIDDEN=1
The text was updated successfully, but these errors were encountered: