[Mesa-dev] [PATCH] Avoid null pointer dereference when glXSwapBuffers is called with no bound context
Sun, Yi
yi.sun at intel.com
Sun Jan 15 01:07:04 PST 2012
The patch could fix the segmentation fault issue while calling function glXSwapBuffers without active current context.
Tested-by: Sun Yi <yi.sun at intel.com>
> -----Original Message-----
> From: mesa-dev-bounces+yi.sun=intel.com at lists.freedesktop.org
> [mailto:mesa-dev-bounces+yi.sun=intel.com at lists.freedesktop.org] On Behalf
> Of Brian Paul
> Sent: Thursday, January 12, 2012 9:38 AM
> To: Anuj Phogat
> Cc: mesa-dev at lists.freedesktop.org
> Subject: Re: [Mesa-dev] [PATCH] Avoid null pointer dereference when
> glXSwapBuffers is called with no bound context
>
> On 01/11/2012 06:06 PM, Anuj Phogat wrote:
> > Calling glXSwapBuffers with no bound context causes segmentation fault in
> > function intelDRI2Flush. All the gl calls should be ignored after setting the
> > current context to null. So the contents of framebuffer stay unchanged.
> > But the driver should not seg fault.
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44614
> >
> > Reported-by: Yi Sun<yi.sun at intel.com>
> > Signed-off-by: Anuj Phogat<anuj.phogat at gmail.com>
> > ---
> > src/mesa/drivers/dri/intel/intel_screen.c | 12 +++++++-----
> > 1 files changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/src/mesa/drivers/dri/intel/intel_screen.c
> b/src/mesa/drivers/dri/intel/intel_screen.c
> > index ce96ddd..03c2a1e 100644
> > --- a/src/mesa/drivers/dri/intel/intel_screen.c
> > +++ b/src/mesa/drivers/dri/intel/intel_screen.c
> > @@ -115,13 +115,15 @@ intelDRI2Flush(__DRIdrawable *drawable)
> > GET_CURRENT_CONTEXT(ctx);
> > struct intel_context *intel = intel_context(ctx);
> >
> > - if (intel->gen< 4)
> > - INTEL_FIREVERTICES(intel);
> > + if (intel != NULL) {
> > + if (intel->gen< 4)
> > + INTEL_FIREVERTICES(intel);
> >
> > - intel->need_throttle = true;
> > + intel->need_throttle = true;
> >
> > - if (intel->batch.used)
> > - intel_batchbuffer_flush(intel);
> > + if (intel->batch.used)
> > + intel_batchbuffer_flush(intel);
> > + }
> > }
> >
> > static const struct __DRI2flushExtensionRec intelFlushExtension = {
>
> Someone from Intel should probably review this, but in the future
> please prefix your commit message with the component being changed.
> And try to keep lines in your commit message under 76 characters:
>
> For example, something like:
>
> intel: fix glXSwapBuffers crash when there's no context"
>
> Thanks.
>
> -Brian
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list