diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-10-17 12:51:05 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-10-17 12:52:31 +0300 |
commit | b65fecd9a093337e397ee0aafc07d57ecc23e855 (patch) | |
tree | d8d49a7f5df75a922fe31212f38aab47929485db /source/blender/gpu/intern | |
parent | b53918be39b951100340615e7c03128bd637a1d5 (diff) |
GPU: Fix memory corruption in GPU_debug on GTX1080
Number of texture formats is 51, which is greater than allowed size of 32.
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r-- | source/blender/gpu/intern/gpu_debug.c | 8 |
1 files changed, 6 insertions, 2 deletions
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) |