Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

stereo: Added bounds checking DisparityMap

A debugging feature to help track down a out of bounds access
happening in LLVM. However it seems to be a lie.
  • Loading branch information...
commit 5b55a1bc46bef161f6bee8a4f3ce5d0ff8e37193 1 parent c57eb4c
@zmoratto zmoratto authored
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/vw/Stereo/DisparityMap.h
View
8 src/vw/Stereo/DisparityMap.h
@@ -107,6 +107,14 @@ namespace stereo {
inline pixel_accessor origin() const { return pixel_accessor( *this, 0, 0 ); }
inline result_type operator()( int32 i, int32 j, int32 p = 0 ) const {
+#if defined(VW_ENABLE_BOUNDS_CHECK) && (VW_ENABLE_BOUNDS_CHECK==1)
+ if ( i < 0 || j < 0 || p < 0 ||
+ i > m_mask1_view.cols() || j > m_mask1_view.rows() ||
+ p > m_mask1_view.planes() ) {
+ vw_throw( ArgumentErr() << "DisparityMaskView::operator() - invalid index [" << i << " "
+ << j << " " << p << "]" );
+ }
+#endif
if ( m_mask1_view(i,j,p) == 0 ||
!is_valid(m_input_view(i,j,p)) ||
i+m_input_view(i,j,p)[0] < 0 || i+m_input_view(i,j,p)[0] >= m_mask2_view.cols() ||
Please sign in to comment.
Something went wrong with that request. Please try again.