Mesa (master): glsl: Fix reading of uninitialized memory

Marek Olšák mareko at kemper.freedesktop.org
Mon Oct 31 11:26:38 UTC 2016


Module: Mesa
Branch: master
Commit: 6770b17b9994942b4bd39fcdb493c2b0866bceaf
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6770b17b9994942b4bd39fcdb493c2b0866bceaf

Author: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
Date:   Thu Oct 13 13:43:29 2016 +0300

glsl: Fix reading of uninitialized memory

Switch to use memory allocations which zero memory for places
where needed.

v2: modify and rebase on top of Marek's series (Tapani)

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
Signed-off-by: Marek Olšák <marek.olsak at amd.com>

---

 src/compiler/glsl/linker.cpp | 4 ++--
 src/compiler/glsl_types.cpp  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 215fcc4..03b866f 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4525,8 +4525,8 @@ link_varyings_and_uniforms(unsigned first, unsigned last,
          return false;
       }
 
-      tfeedback_decls = ralloc_array(mem_ctx, tfeedback_decl,
-                                     num_tfeedback_decls);
+      tfeedback_decls = rzalloc_array(mem_ctx, tfeedback_decl,
+                                      num_tfeedback_decls);
       if (!parse_tfeedback_decls(ctx, prog, mem_ctx, num_tfeedback_decls,
                                  varying_names, tfeedback_decls))
          return false;
diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp
index 3918c2f..744b457 100644
--- a/src/compiler/glsl_types.cpp
+++ b/src/compiler/glsl_types.cpp
@@ -149,8 +149,8 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields,
    init_ralloc_type_ctx();
    assert(name != NULL);
    this->name = ralloc_strdup(this->mem_ctx, name);
-   this->fields.structure = ralloc_array(this->mem_ctx,
-                                         glsl_struct_field, length);
+   this->fields.structure = rzalloc_array(this->mem_ctx,
+                                          glsl_struct_field, length);
    for (i = 0; i < length; i++) {
       this->fields.structure[i] = fields[i];
       this->fields.structure[i].name = ralloc_strdup(this->fields.structure,




More information about the mesa-commit mailing list