RTKConsortium / RTK

Reconstruction Toolkit
Apache License 2.0
246 stars 145 forks source link

BUG: Fix above array bounds access of image size in rtkamsterdamshroud #580

Closed SimonRit closed 9 months ago

SimonRit commented 9 months ago

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];