OSDN Git Service

mesa: add bounds checking for uniform array access
authorFrank Henigman <fjhenigman@google.com>
Fri, 14 Dec 2012 20:52:17 +0000 (15:52 -0500)
committerStéphane Marchesin <marcheu@chromium.org>
Fri, 21 Dec 2012 19:23:48 +0000 (11:23 -0800)
commit46e3aeb07702f57d389fbfcade9d4ef66218dc53
treec5fa084730adbf302287e6e07e132b512d4f209f
parent74f07319533d39a509ddc3159a51cfe89cd47225
mesa: add bounds checking for uniform array access

No piglit regressions and now passes glsl-uniform-out-of-bounds-2.

validate_uniform_parameters now checks that the array index is
valid.  This means if an index is out of bounds, glGetUniform* now
fails with GL_INVALID_OPERATION, as it should.
_mesa_uniform and _mesa_uniform_matrix also call
validate_uniform_parameters so the bounds checks there became
redundant and were removed.

The test in glGetUniformLocation is modified to check array bounds
so it now returns GL_INVALID_INDEX (-1) if you ask for the location
of a non-existent array element, as it should.

Signed-off-by: Frank Henigman <fjhenigman@google.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
src/mesa/main/uniform_query.cpp