glsl: Fix reading of uninitialized memory
authorJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Thu, 13 Oct 2016 10:43:29 +0000 (13:43 +0300)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 31 Oct 2016 10:53:38 +0000 (11:53 +0100)
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@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
src/compiler/glsl/linker.cpp
src/compiler/glsl_types.cpp

index 215fcc409f7dc19a0386cee5e4570e91a834737c..03b866f29130df4ea0d2ca501672cc381bd67269 100644 (file)
@@ -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;
index 3918c2f16b02294cac8b44dd7b4f4bbf7eb04ebc..744b457013df13bbd1383f1a403d9324a6642422 100644 (file)
@@ -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,