Repository navigation
BUG: Throw from DCMTKImageIO::ReadImageInformation on an unreadable file - #7237
Merged
hjmjohnson merged 1 commit intoNov 25, 2026
Merged
hjmjohnson merged 1 commit into
hjmjohnson merged 1 commit into
Conversation
ReadImageInformation() caught the exception from DCMTKFileReader::LoadFile(), printed a message, and continued with a null dataset, so the next tag lookup crashed. Let the exception propagate so callers receive an ExceptionObject.
7 tasks done
dzenanz
approved these changes
Nov 25, 2026
dzenanz
marked this pull request as ready for review
November 25, 2026 20:25
Contributor
Contributor
[Medium impact] The PR appears safe to merge.
|
hjmjohnson
approved these changes
Nov 25, 2026
hjmjohnson
merged commit Nov 25, 2026
d7a6fb8
into
InsightSoftwareConsortium:main
20 of 21 checks passed
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.
Replaces #7236, which GitHub closed after a bad force-push. Same fix; the test now also checks that its non-DICOM input file was written, per the review there.
DCMTKImageIO::ReadImageInformation()swallowed the exception fromDCMTKFileReader::LoadFile()and continued with a null dataset, so reading any unreadable DICOM segfaulted in the next tag lookup. The exception now propagates, so callers get a catchableitk::ExceptionObject; a new GTest reads a non-DICOM file.Fixes #6719
Testing and AI disclosure
ITKIODCMTKGTestDriver --gtest_filter=DCMTKImageIO.ReadImageInformationThrowsOnUnreadableFilesegfaults (exit 139) without the fix and passes with it;ctest -L ITKIODCMTKpasses 25/25 with ExternalData fetched. pre-commit hooks pass.Prepared with AI assistance; I reviewed and tested every changed line.
PR Checklist