alicevision / CCTag

Detection of CCTag markers made up of concentric circles.
https://cctag.readthedocs.io
Mozilla Public License 2.0
358 stars 89 forks source link

[cctag] fix (potential) access out of bound error in opencv #180

Closed simogasp closed 2 years ago

simogasp commented 2 years ago

There is a reported crash when running in debug with access out of bound raised by OpenCV, In reality, there is no real access to the memory but just the declaration of a pointer that may point outside the memory. All the operations are then made in the safe bound.

The solution is to move the declaration inside the good range.

fix #179

Note: to reproduce this behavior on a non-windows machine the _DEBUG preprocessor must be defined because the assert raising the error is defined based on that definition in OpenCV

simogasp commented 2 years ago

when approved, I'd like to run the code formatting for this file alone before merging, because it's hard to read (but I didn't want to pollute the PR)