From e5f54c584acded3092f3d9dbdd3cd0c0a5ad12d3 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Wed, 27 Aug 2014 20:27:30 -0500 Subject: [PATCH] Fix incorrect rgbGen const reading uninitialized memory If ParseVector fails, color isn't fully set. --- code/renderergl1/tr_shader.c | 2 ++ code/renderergl2/tr_shader.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/code/renderergl1/tr_shader.c b/code/renderergl1/tr_shader.c index 103d329f..4e2e6f6c 100644 --- a/code/renderergl1/tr_shader.c +++ b/code/renderergl1/tr_shader.c @@ -847,6 +847,8 @@ static qboolean ParseStage( shaderStage_t *stage, char **text ) { vec3_t color; + VectorClear( color ); + ParseVector( text, 3, color ); stage->constantColor[0] = 255 * color[0]; stage->constantColor[1] = 255 * color[1]; diff --git a/code/renderergl2/tr_shader.c b/code/renderergl2/tr_shader.c index cbb01121..d5b053de 100644 --- a/code/renderergl2/tr_shader.c +++ b/code/renderergl2/tr_shader.c @@ -1091,6 +1091,8 @@ static qboolean ParseStage( shaderStage_t *stage, char **text ) { vec3_t color; + VectorClear( color ); + ParseVector( text, 3, color ); stage->constantColor[0] = 255 * color[0]; stage->constantColor[1] = 255 * color[1];