st/mesa: remove redundant stfb->iface checks

stfb->iface is always non-NULL for an st_framebuffer. These checks
were incorrect, relying on out-of-bounds memory access in the
surface-less case of EGL_KHR_surfaceless_context.

v2: remove redundant stread check (Marek)

Reviewed-by: Marek Olšák <marek@olsak@amd.com> (v2)
This commit is contained in:
Nicolai Hähnle 2017-04-21 15:11:34 +02:00
parent 19b61799e3
commit 9d346af322
2 changed files with 2 additions and 9 deletions

View file

@ -54,9 +54,9 @@ static void st_viewport(struct gl_context *ctx)
stdraw = st_ws_framebuffer(st->ctx->DrawBuffer);
stread = st_ws_framebuffer(st->ctx->ReadBuffer);
if (stdraw && stdraw->iface)
if (stdraw)
stdraw->iface_stamp = p_atomic_read(&stdraw->iface->stamp) - 1;
if (stread && stread != stdraw && stread->iface)
if (stread && stread != stdraw)
stread->iface_stamp = p_atomic_read(&stread->iface->stamp) - 1;
}

View file

@ -176,10 +176,6 @@ st_framebuffer_validate(struct st_framebuffer *stfb,
boolean changed = FALSE;
int32_t new_stamp;
/* Check for incomplete framebuffers (e.g. EGL_KHR_surfaceless_context) */
if (!stfb->iface)
return;
new_stamp = p_atomic_read(&stfb->iface->stamp);
if (stfb->iface_stamp == new_stamp)
return;
@ -281,9 +277,6 @@ st_framebuffer_add_renderbuffer(struct st_framebuffer *stfb,
enum pipe_format format;
boolean sw;
if (!stfb->iface)
return FALSE;
assert(_mesa_is_winsys_fbo(&stfb->Base));
/* do not distinguish depth/stencil buffers */