Commit 46f7e4ef authored by Marek Olšák's avatar Marek Olšák

run: don't use alloca to avoid random crashes in the GLSL compiler

Reviewed-by: default avatarTimothy Arceri <timothy.arceri@collabora.com>
parent 02b6a621
......@@ -663,7 +663,10 @@ main(int argc, char **argv)
if (use_separate_shader_objects) {
for (unsigned i = 0; i < num_shaders; i++) {
const char *const_text;
char *text = alloca(shader[i].length + 1);
unsigned size = shader[i].length + 1;
/* Using alloca crashes in the GLSL compiler. */
char *text = malloc(size);
memset(text, 0, size);
/* Make it zero-terminated. */
memcpy(text, shader[i].text, shader[i].length);
......@@ -673,6 +676,7 @@ main(int argc, char **argv)
GLuint prog = glCreateShaderProgramv(shader[i].type, 1,
&const_text);
glDeleteProgram(prog);
free(text);
}
} else if (type == TYPE_CORE || type == TYPE_COMPAT) {
GLuint prog = glCreateProgram();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment