Repository navigation
BUG: Reject an HDF5 lattice constants dataset that does not hold 6 values - #84
Closed
imikejackson wants to merge 1 commit into
Closed
imikejackson wants to merge 1 commit into
imikejackson wants to merge 1 commit into
Conversation
…lues - H5AngReader, H5CtfReader and H5EspritReader read a phase's LatticeConstants dataset with READ_PHASE_HEADER_ARRAY, which accepts a vector of any length. Callers index all 6 values (a, b, c, alpha, beta, gamma), so a short dataset was read past its end and a long one was silently accepted. - The new READ_PHASE_LATTICE_CONSTANTS macro reads the dataset and returns error -90350 with a message that names the file, the phase and the number of values when the dataset does not hold exactly 6 values. - H5AngVolumeReader and H5CtfVolumeReader pass the file name to the slice reader that reads the phases so that the message names the file. - New test H5LatticeConstantsTest covers 2, 7 and 6 values for all three readers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7 tasks done
Collaborator
Author
|
Closed in favor of #86, which merges this branch (with its history) together with the other open EbsdLib fixes for the next release, so simplnx can build against one EbsdLib branch. The branch is kept. 🤖 Generated with Claude Code |
23 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The HDF5 phase readers accepted a lattice constants dataset of any length.
H5AngReader,H5CtfReaderandH5EspritReaderread a phase'sLatticeConstantsdataset withREAD_PHASE_HEADER_ARRAY, which stores whatever vector is in the file. Every caller indexes 6 values (a, b, c, alpha, beta, gamma), so a 2-element dataset was accepted and later read past its end, and a 7-element dataset was accepted silently.READ_PHASE_LATTICE_CONSTANTSinEbsdMacros.hreads the dataset throughREAD_PHASE_HEADER_ARRAYand then rejects it when it does not hold exactly 6 values. The three readers use it in place ofREAD_PHASE_HEADER_ARRAYfor the lattice constants only (Categoriesstays variable length).H5AngVolumeReader::getPhases()andH5CtfVolumeReader::getPhases()now pass the file name to the slice reader that reads the phases, so the message names the file.LatticeConstantsdataset of a phase does not hold exactly 6 valuesExample message:
H5EspritReader Error: The 'LatticeConstants' dataset of phase '1' in file '<path>' holds 2 values but 6 (a, b, c, alpha, beta, gamma) are required.Other HDF5 readers checked:
H5OIMReaderreads six scalar datasets (Lattice Constant a...gamma) into a 6-element vector, so the count is always 6.H5OINAReaderalready rejectsLattice Dimensions/Lattice Angleswith fewer than 3 values (-90031 / -90032) and builds the 6-element vector itself.Not changed here:
H5CtfReader::readFile()ignores the result ofreadHeader()(it keeps going toreadData());H5CtfVolumeReader::getPhases()prints tostd::coutinstead of setting an error. Both are separate defects.Test Plan
EbsdLib::ebsdlib::H5LatticeConstantsTest::{H5AngReader,H5CtfReader,H5EspritReader}(new fileSource/Test/H5LatticeConstantsTest.cpp) writes a slice withH5AngImporter/H5CtfImporter(or copies the Esprit test file), replaces phase 1'sLatticeConstantswith 2, 7 and 6 values and callsreadHeaderOnly().develop: all three readers return success for 2 and 7 values (REQUIRE( err < 0 )fails with0 < 0, phase lattice constants count 2 / 7).ci-linux-x64preset): fullctestsuite, 432/432 passed.Related Issue
Related to BlueQuartzSoftware/simplnx#1866 (items
ReadH5EbsdFilter#4andReadH5EspritDataFilter#2).Merge notes: no overlap in code with the open PRs. #72 changes
H5AngVolumeReader::getPhases()a few lines below the addedsetFileName()call; both merge cleanly (checked withgit merge-tree). The sibling PR for the pattern dataset checks (fix/h5-pattern-dataset-checks) also merges cleanly with this one.The
bluequartz-skillsplugin skills were not available in this environment; the change follows the repository's.clang-formatand coding standards.🤖 Generated with Claude Code