Skip to content

Uninitialised memory read in readhdf5.C#243

Open
lispandfound wants to merge 1 commit into
geodynamics:masterfrom
ucgmsim:fix_readhdf5_attrs
Open

Uninitialised memory read in readhdf5.C#243
lispandfound wants to merge 1 commit into
geodynamics:masterfrom
ucgmsim:fix_readhdf5_attrs

Conversation

@lispandfound

Copy link
Copy Markdown

The hid_t types grp, dset, attr are uninitialised, which compounds with a bug in the assertions that checks that the attr variable is read correctly instead of dset. For some combination of compile flags this results in the attr variable having positive garbage values meaning all the assertions are meaningless. If you are unlucky compiling this code attr gets negative garbage values which results in a crash. Fix is to initialise datasets in the beginning and fix the assertions.

The `hid_t` types `grp, dset, attr` are uninitialised, which compounds with a
bug in the assertions that checks that the `attr` variable is read correctly
instead of `dset`. For some combination of compile flags this results in the `attr`
variable having positive garbage values meaning all the assertions are
meaningless if none of the optional ISNSEW, WindowL, WindowR attributes are set.
If you are unlucky compiling this code attr gets negative garbage values which
results in a crash. Fix is to initialise datasets in the beginning and fix the assertions.
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.

1 participant