On Fri, 31 Oct 2025 14:00:38 GMT, Justin King <[email protected]> wrote:
> Check whether `osSupport::map_memory` actually succeeded in all compliation
> modes, instead of crashing shortly after in non-debug builds. Ideally we
> should fall back to just reading the entire file into memory manually or use
> seek+read, but this is good enough for now to avoid crashing.
src/java.base/share/native/libjimage/imageFile.cpp line 334:
> 332: // Memory map image (minimally the index.)
> 333: _index_data = (u1*)osSupport::map_memory(_fd, _name, 0,
> (size_t)map_size());
> 334: if (_index_data == nullptr) {
The rest of the code in the `libjimage` library uses `NULL`, including the
return value in `osSupport::map_memory(...)`. So I think it would be better to
use `NULL` here for consistency.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28087#discussion_r2513032659