[Mesa-dev] [PATCH] glx: Fix use-before-null-check in dri2InvalidateBuffers().
Ian Romanick
idr at freedesktop.org
Thu Jun 2 14:43:35 PDT 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 06/01/2011 01:42 PM, Eric Anholt wrote:
> The compiler used our dereference here to skip the NULL check below.
> Fixes window resize in "jconsole -J-Dsun.java2d.opengl=True" under
> OpenJDK 6.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37766
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
> src/glx/dri2_glx.c | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
> index b9f6f7f..69b47ae 100644
> --- a/src/glx/dri2_glx.c
> +++ b/src/glx/dri2_glx.c
> @@ -675,9 +675,14 @@ dri2InvalidateBuffers(Display *dpy, XID drawable)
> {
> __GLXDRIdrawable *pdraw =
> dri2GetGlxDrawableFromXDrawableId(dpy, drawable);
> - struct dri2_screen *psc = (struct dri2_screen *) pdraw->psc;
> + struct dri2_screen *psc;
> struct dri2_drawable *pdp = (struct dri2_drawable *) pdraw;
>
> + if (!pdraw)
> + return;
> +
> + psc = (struct dri2_screen *) pdraw->psc;
> +
> #if __DRI2_FLUSH_VERSION >= 3
> if (pdraw && psc->f && psc->f->base.version >= 3 && psc->f->invalidate)
> psc->f->invalidate(pdp->driDrawable);
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAk3oBAcACgkQX1gOwKyEAw8gIQCfceIuidyptdCsJ//M8WKn60AB
dNAAnRx6x6M+SRx20fu6KEGMSu92689o
=/5+s
-----END PGP SIGNATURE-----
More information about the mesa-dev
mailing list