[Bf-blender-cvs] [b65fecd9a09] master: GPU: Fix memory corruption in GPU_debug on GTX1080

Sergey Sharybin noreply at git.blender.org
Tue Oct 17 11:53:58 CEST 2017


Commit: b65fecd9a093337e397ee0aafc07d57ecc23e855
Author: Sergey Sharybin
Date:   Tue Oct 17 11:51:05 2017 +0200
Branches: master
https://developer.blender.org/rBb65fecd9a093337e397ee0aafc07d57ecc23e855

GPU: Fix memory corruption in GPU_debug on GTX1080

Number of texture formats is 51, which is greater than allowed size of 32.

===================================================================

M	source/blender/gpu/intern/gpu_debug.c

===================================================================

diff --git a/source/blender/gpu/intern/gpu_debug.c b/source/blender/gpu/intern/gpu_debug.c
index 7a0562617d6..73133a6caab 100644
--- a/source/blender/gpu/intern/gpu_debug.c
+++ b/source/blender/gpu/intern/gpu_debug.c
@@ -425,9 +425,11 @@ void GPU_assert_no_gl_errors(const char *file, int line, const char *str)
 
 static void gpu_state_print_fl_ex(const char *name, GLenum type)
 {
+#define MAX_ARRAY_SIZE 64
+
 	const unsigned char err_mark[4] = {0xff, 0xff, 0xff, 0xff};
 
-	float value[32];
+	float value[MAX_ARRAY_SIZE];
 	int a;
 
 	memset(value, 0xff, sizeof(value));
@@ -435,7 +437,7 @@ static void gpu_state_print_fl_ex(const char *name, GLenum type)
 
 	if (glGetError() == GL_NO_ERROR) {
 		printf("%s: ", name);
-		for (a = 0; a < 32; a++) {
+		for (a = 0; a < MAX_ARRAY_SIZE; a++) {
 			if (memcmp(&value[a], err_mark, sizeof(value[a])) == 0) {
 				break;
 			}
@@ -443,6 +445,8 @@ static void gpu_state_print_fl_ex(const char *name, GLenum type)
 		}
 		printf("\n");
 	}
+
+#undef MAX_ARRAY_SIZE
 }
 
 #define gpu_state_print_fl(val) gpu_state_print_fl_ex(#val, val)



More information about the Bf-blender-cvs mailing list