Repository navigation
BUG: Validate the pattern dataset in the Esprit and OIM HDF5 readers - #83
Closed
imikejackson wants to merge 1 commit into
Closed
imikejackson wants to merge 1 commit into
imikejackson wants to merge 1 commit into
Conversation
- H5EspritReader (RawPatterns) and H5OIMReader (Pattern) read dims[1] and dims[2] of the pattern dataset without checking its rank, did not check that it holds one pattern per scan point or that it holds integer pixels, and ignored the error from reading it. A short dataset was accepted and later code (raster reordering, callers) read past the end of the pattern buffer. - Both readers now require a rank 3 dataset whose first dimension equals the scan's point count and whose type is integer, and report a read failure. Each failure sets a new error code and a message that names the file, the scan and the dataset (H5EspritReader -90330..-90333, H5OIMReader -90430..-90433). Valid files are read as before. - H5OIMReader::readFile() keeps the readData() message when it reports -900022, as in BlueQuartzSoftware#70. - New test H5PatternDatasetTest covers valid, rank 2, short, floating point and unreadable pattern datasets for both 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 |
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
H5EspritReader(RawPatterns) andH5OIMReader(Pattern) read the pattern dataset without validating it:dims[1]anddims[2]were read even when the dataset has fewer than 3 dimensions (out-of-boundsstd::vectoraccess).points x height x width;H5EspritReader::applyRasterOrder()and every caller then read past its end (the new test crashes with a bus error ondevelop).uint8).H5Lite::readPointerDataset()was ignored, so a failed read returned success.Both readers now require a rank 3 integer dataset whose first dimension equals the scan's point count, and report a read failure. Each failure sets a new error code and a message that names the file, the scan and the dataset, for example
H5EspritReader Error: The 'RawPatterns' dataset of scan 'Section_435' in file '<path>' holds 10 patterns but the scan has 360000 points (600 x 600).Files without a pattern dataset, or with a valid one, are read as before.H5OIMReader::readFile()reports everyreadData()failure as -900022 and, ondevelop, replaced the message with an empty string. It now keeps thereadData()message; this hunk is identical to the one in #70.Merge order
#70 (
issue69-reader-error-messages) rewrites the error-message handling in the same two files. Please merge #70 first. This branch follows its message style (std::stringstream+setErrorMessage(ss.str())), and its only change outsidereadData()is the same hunk #70 makes inH5OIMReader::readFile().git merge-treeshows that this branch and #70 merge cleanly in either order. The new tests are in a new file so they do not conflict with the tests #70 appends toEdaxOIMReaderTest.cppandH5EspritReaderTest.cpp.Test Plan
EbsdLib::ebsdlib::H5PatternDatasetTest::{H5EspritReaderValidatesRawPatterns,H5OIMReaderValidatesPattern}(new fileSource/Test/H5PatternDatasetTest.cpp) adds a synthetic pattern dataset to a copy of the Esprit and EDAX test scans: valid (N x 3 x 2uint8), rank 2, 10 patterns only, float, and unreadable (external storage file that does not exist).develop: Esprit returns 0 for the rank 2 dataset (0 == -90330) and crashes with a bus error on the short dataset; OIM returns 0 for all four invalid datasets (0 == -900022).ci-linux-x64preset): fullctestsuite, 431/431 passed.Related Issue
Related to BlueQuartzSoftware/simplnx#1867 (class C07d,
ReadH5EspritData.cpp:109, and itemReadH5OimDataFilter#4).The
bluequartz-skillsplugin skills were not available in this environment; the change follows the repository's.clang-formatand coding standards.🤖 Generated with Claude Code