When loading an external field from file if the bounds in the file do not include ghost cells an out of bounds array access occurs and corrupts memory. #5588
Labels
bug
Something isn't working
Description
In RZ/3D modes when loading an external field from a file, the tilebox that is looped over to load into the array is a grown tilebox.
Expected behavior
I expected only internal cells to be interpolated and the ghosts to be filled by setting the boundary conditions after a load.
How to reproduce
This is part of a CI test being developed in PR #5275
I needed to generate an OpenPMD file larger than the total domain to avoid accessing out of bounds array elements in the array that is loaded from file.
The problem arises from growing the tilebox of output in the kernel that interpolates data to the mesh from the file. In WarpXInitData.cpp: WarpX::ReadExternalFieldFromFile (
const std::string& read_fields_from_path, amrex::MultiFab* mf,
const std::string& F_name, const std::string& F_component)
System information
Please check all relevant boxes and provide details.
This issue is being generated as a placeholder to discuss appropriate options. E.g. should an error be thrown, extrapolation, or zero filling occur when the total simulation domain exceeds the domain of the input file?
The text was updated successfully, but these errors were encountered: