Commit 2ff1610307d6e780c0bf33751bad4aac83c89cad

Con Kolivas 2012-10-06T14:58:26

Prevent corrupt values returned from the opencl code from trying to read beyond the end of the buffer by masking the value to a max of 15.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/findnonce.c b/findnonce.c
index 788835d..344c7d1 100644
--- a/findnonce.c
+++ b/findnonce.c
@@ -252,6 +252,9 @@ static void *postcalc_hash(void *userdata)
 
 	pthread_detach(pthread_self());
 
+	/* To prevent corrupt values in FOUND from trying to read beyond the
+	 * end of the res[] array */
+	pcd->res[FOUND] &= FOUND;
 	for (entry = 0; entry < pcd->res[FOUND]; entry++) {
 		uint32_t nonce = pcd->res[entry];