On 04/23/2013 02:39 AM, Kenneth Graunke wrote:
Otherwise, the table could be full of uninitialized garbage.  That means
the NULL check at the bottom might not happen, so we wouldn't get the
_mesa_problem, and we'd then return garbage.

format_pack.c also has tables like this and memsets them.

This *CANNOT* be the right fix. This just papers over things. There are a lot of entries in the table that are not initialized when several similar entries are initialized. For example, *ONE* of the ETC2 entries is missing. Many of the integer formats are present, but some are missing. Etc.

Signed-off-by: Kenneth Graunke <kenn...@whitecape.org>
---
  src/mesa/main/format_unpack.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c
index 0933b4e..7206d25 100644
--- a/src/mesa/main/format_unpack.c
+++ b/src/mesa/main/format_unpack.c
@@ -1730,6 +1730,8 @@ get_unpack_rgba_function(gl_format format)
     static GLboolean initialized = GL_FALSE;

     if (!initialized) {
+      memset(table, 0, sizeof(table));
+
        table[MESA_FORMAT_NONE] = NULL;

        table[MESA_FORMAT_RGBA8888] = unpack_RGBA8888;


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to