Skip to content

Commit

Permalink
BUG: Fix above array bounds access of image size in rtkamsterdamshroud
Browse files Browse the repository at this point in the history
The bug was detected with gcc and -Wall option which produced the following warning:

/home/srit/src/itk/itk/Modules/Core/Common/include/itkSize.h:356:85: warning: array subscript 2 is above array bounds of ‘const SizeValueType [2]’ {aka ‘const long unsigned int [2]’} [-Warray-bounds]
  356 |   constexpr const_reference operator[](size_type pos) const { return m_InternalArray[pos]; }
      |                                                                      ~~~~~~~~~~~~~~~^
/home/srit/src/itk/itk/Modules/Core/Common/include/itkSize.h:242:40: note: while referencing ‘itk::Size<2>::m_InternalArray’
  242 |   alignas(SizeValueType) SizeValueType m_InternalArray[VDimension];
  • Loading branch information
Simon Rit authored and SimonRit committed Feb 21, 2024
1 parent c32c1e9 commit 6ddf14b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion applications/rtkamsterdamshroud/rtkamsterdamshroud.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ main(int argc, char * argv[])
WriterType::Pointer writer = WriterType::New();
writer->SetFileName(args_info.output_arg);
writer->SetInput(shroudFilter->GetOutput());
writer->SetNumberOfStreamDivisions(shroudFilter->GetOutput()->GetLargestPossibleRegion().GetSize(2));
writer->SetNumberOfStreamDivisions(shroudFilter->GetOutput()->GetLargestPossibleRegion().GetSize(1));

TRY_AND_EXIT_ON_ITK_EXCEPTION(writer->Update())

Expand Down

0 comments on commit 6ddf14b

Please sign in to comment.