Repository navigation
BUG: Reject transform parameter counts that exceed the metric limit - #6991
Merged
dzenanz merged 1 commit intoOct 27, 2026
Conversation
jdotc1
marked this pull request as ready for review
October 23, 2026 04:28
Contributor
[Medium impact] The PR appears safe to merge.
|
hjmjohnson
force-pushed
the
fix/jdotc1-metric-count-overflow-20261022
branch
from
October 25, 2026 19:57
5cecfc0 to
cfd822c
Compare
ObjectToObjectMetric::GetNumberOfParameters returned the moving transform's 64-bit IdentifierType count through the metric's unsigned int NumberOfParametersType, so a dense displacement field with more than 2^32 - 1 parameters was silently truncated. Callers then sized the derivative from the truncated count and wrote past its end. Throw instead when the count does not fit. This makes the overflow a clear error; widening the metric API remains open. Addresses InsightSoftwareConsortium#6949.
hjmjohnson
force-pushed
the
fix/jdotc1-metric-count-overflow-20261022
branch
from
October 25, 2026 20:05
cfd822c to
cc15831
Compare
dzenanz
approved these changes
Oct 27, 2026
dzenanz
left a comment
Member
There was a problem hiding this comment.
The fix looks good. I have not taken a good look at the test.
This was referenced Nov 19, 2026
gdevenyi
added a commit
to gdevenyi/ITK
that referenced
this pull request
Nov 19, 2026
The v4 metrics returned the transform's 64-bit parameter count through an unsigned int, so a dense displacement field with more than 2^32 - 1 parameters (about 1.43 billion voxels in 3-D) could not be registered; the guard from InsightSoftwareConsortium#6991 throws there. CostFunctionTemplate and ObjectToObjectMetricBaseTemplate now use IdentifierType, as TransformBase does, and overrides return NumberOfParametersType. The guard can no longer fire and is removed. ImageVectorOptimizerParametersHelper also keeps its voxel count as SizeValueType. Closes InsightSoftwareConsortium#6949.
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.
Reject transform parameter counts that exceed the metric return type. Addresses the diagnostic-guard alternative in #6949.
Scope and risk
This rejects unsupported large counts; it does not add a 64-bit metric API or fix every allocation path. The test uses a dummy count and must not allocate a multi-billion-voxel field.
Validation
6 isolated method-body boundary cases compile and pass under GCC with AddressSanitizer/UndefinedBehaviorSanitizer.
Native ITK validation is now available for current head
5cecfc06745aa8c5e6153e3215b1b5323a52d2ee. The Linux ARM64 job compiled with zero compiler errors and warnings and passed all 4,722 configured tests. The actualCountMetric/CountTransformGTest fixture compiled, and bothObjectToObjectMetric.PreservesRepresentableParameterCountsandObjectToObjectMetric.RejectsParameterCountOverflowpassed.The current-head platform matrix has completed: 18 checks passed, with no pending or failing reported checks. The only skipped job is
publish-doxygen-tagfile. Completed checks include Windows C++, macOS and Ubuntu Pixi C++, x86_64 Rosetta, ARM Python, Azure Linux and macOS Python, pre-commit, Doxygen, performance and documentation. The native Linux ARM64 test results above are reused; no tests were repeated for this status update.Ready for maintainer review. The results establish the native tests on the completed configurations; they do not establish every possible platform-dependent integer-width combination. Maintainer review is needed before merging.