On Mon, Apr 22, 2013 at 5:39 PM, Kenneth Graunke <kenn...@whitecape.org> 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.
>
> 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;
> --
> 1.8.2.1

Reviewed-by: Matt Turner <matts...@gmail.com>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to