Skip to content

#14213 HDF5Exporter: Guard null m_hdfFile in createGroup#14214

Merged
magnesj merged 1 commit into
OPM:devfrom
magnesj:fix-14213-hdf5-creategroup-null
Jun 12, 2026
Merged

#14213 HDF5Exporter: Guard null m_hdfFile in createGroup#14214
magnesj merged 1 commit into
OPM:devfrom
magnesj:fix-14213-hdf5-creategroup-null

Conversation

@magnesj

@magnesj magnesj commented Jun 12, 2026

Copy link
Copy Markdown
Member

Fixes #14213

Problem

When new H5::H5File throws in the RifHdf5Exporter constructor, the exception is swallowed and m_hdfFile is left null (#13883 made this reliable). createGroup( nullptr, ... ) then dereferences the null m_hdfFile; the surrounding try/catch(...) cannot catch the resulting SIGSEGV. This crashes HDF5 summary export when the target file cannot be created (unwritable directory, locked file, disk full, invalid path).

Fix

Guard the else branch with m_hdfFile before dereferencing, matching the existing parentGroup null check in the same function. On failure an empty H5::Group is returned, which callers already handle (writeDataset wraps createDataSet in try/catch).

@kriben kriben left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@magnesj magnesj merged commit 5b7bdf7 into OPM:dev Jun 12, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stacktrace RifHdf5Exporter::createGroup

2 participants