Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Feb 21, 2024

Conversation

SimonRit
Copy link
Collaborator

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

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];
@SimonRit SimonRit merged commit 6ddf14b into RTKConsortium:master Feb 21, 2024
16 of 40 checks passed
@SimonRit SimonRit deleted the AmsterdamShroudWarning branch February 21, 2024 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant