From 1283ecd9dfecadaa4871004e73a76516961c018b Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Fri, 23 Oct 2020 15:47:53 +0300
Subject: [PATCH] Possible fix for mem access bug

---
 lib/libsgm/src/census_transform.cu | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/libsgm/src/census_transform.cu b/lib/libsgm/src/census_transform.cu
index df3888618..d437f978e 100644
--- a/lib/libsgm/src/census_transform.cu
+++ b/lib/libsgm/src/census_transform.cu
@@ -134,7 +134,8 @@ __global__ void census_transform_kernel(
 		}
 	}
 
-	dest[x+y*width] = res;
+	// FIXME: Should use feature pitch, not width.
+	if (x < width && y < height) dest[x+y*width] = res;
 }
 
 template <typename T>
-- 
GitLab