egl: Add eglQuerySurface surface type check for EGL_LARGEST_PBUFFER attrib
authorFrank Binns <frank.binns@imgtec.com>
Fri, 31 Jul 2015 08:11:45 +0000 (09:11 +0100)
committerEric Anholt <eric@anholt.net>
Wed, 5 Aug 2015 03:03:16 +0000 (20:03 -0700)
commitb2c5986ea1c8e66c4e0a05bcacbcf28c27f5b183
treebfc1a598e9b643bd95b2105d18d373b511c2100f
parentcfc3200a35647026a0b5cf188f378ce33802044b
egl: Add eglQuerySurface surface type check for EGL_LARGEST_PBUFFER attrib

Calling eglQuerySurface on a window or pixmap with the EGL_LARGEST_PBUFFER
attribute resulted in the contents of the 'value' parameter being modified.
This is the wrong behaviour according to the EGL spec, which states:

    "Querying EGL_LARGEST_PBUFFER for a pbuffer surface returns the
     same attribute value specified when the surface was created with
     eglCreatePbufferSurface. For a window or pixmap surface, the
     contents of value are not modified."

Avoid this from happening by checking that the surface type is EGL_PBUFFER_BIT
before modifying the contents of the parameter.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/egl/main/eglsurface.c