Skip to content
Commit 1afae6f3 authored by Ian Romanick's avatar Ian Romanick Committed by Juan A. Suarez Romero
Browse files

mesa: Don't write to user buffer in glGetTexParameterIuiv on error



With some sets of optimization flags, GCC will generate warnings like
this:

src/mesa/main/texparam.c:2327:27: warning: ‘*((void *)&ip+12)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             params[3] = ip[3];
                         ~~^~~
src/mesa/main/texparam.c:2320:16: note: ‘*((void *)&ip+12)’ was declared here
          GLint ip[4];
                ^~

ip is not initialized in cases where a GL error is generated.  In these
cases, we should *not* write to the user's buffer, so this is actually a
bug.  I wrote a new piglit test gl-3.0-texparameteri to show this bug.

I suspect that Coverity also detected this, but the scan site is
currently down.

Fixes: c2c50778 "main: Added entry points for glGetTextureParameteriv, Iiv, and Iuiv."
Signed-off-by: default avatarIan Romanick <ian.d.romanick@intel.com>
Reviewed-by: default avatarMatt Turner <mattst88@gmail.com>
(cherry picked from commit def0030e)
parent b2603cdd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment