[Mesa-dev] [PATCH 0/2] v3: Fix array overrun with too many uniforms

Petri Latvala petri.latvala at intel.com
Wed Nov 27 05:28:07 PST 2013


Third version of this patch series sent in full, both patches changed
a bit.

As per advice, I assigned the required size to prog_data->nr_params,
which is unused until vec4_visitor::setup_uniforms() sets it
again. This is done in do_vs_prog() and do_gs_prog(), with
accompanying comments that explain the implications.

I tested this patch with a test program and ran piglit tests, until no
regressions were found. To my understanding, the allocated size is
enough for user-defined uniforms, builtin uniforms, clip planes, and
sampler variables, with some extra which I think comes from padding
somewhere earlier. Extra means something like 3 or 7 too much, not a
factor too much.

I removed the noncopyable chunk by request too, that will possibly be
sent later in a separate patch.


Petri Latvala (2):
  i965: Allocate vec4_visitor's uniform_size and uniform_vector_size
    arrays     dynamically.
  i965: Assert array index on access to vec4_visitor's arrays.

 src/mesa/drivers/dri/i965/brw_vec4.cpp         |  2 ++
 src/mesa/drivers/dri/i965/brw_vec4.h           |  5 +++--
 src/mesa/drivers/dri/i965/brw_vec4_gs.c        |  5 +++++
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 13 +++++++++++++
 src/mesa/drivers/dri/i965/brw_vs.c             |  8 ++++++++
 5 files changed, 31 insertions(+), 2 deletions(-)

-- 
1.8.4.rc3



More information about the mesa-dev mailing list