<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Apr 25, 2017 11:23 AM, "Nicolai Hähnle" <<a href="mailto:nhaehnle@gmail.com">nhaehnle@gmail.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Nicolai Hähnle <<a href="mailto:nicolai.haehnle@amd.com">nicolai.haehnle@amd.com</a>><br>
<br>
stfb->iface is always non-NULL for an st_framebuffer. These checks<br>
were incorrect, relying on out-of-bounds memory access in the<br>
surface-less case of EGL_KHR_surfaceless_context.<br>
---<br>
src/mesa/state_tracker/st_cb_<wbr>viewport.c | 4 ++--<br>
src/mesa/state_tracker/st_<wbr>manager.c | 7 -------<br>
2 files changed, 2 insertions(+), 9 deletions(-)<br>
<br>
diff --git a/src/mesa/state_tracker/st_<wbr>cb_viewport.c b/src/mesa/state_tracker/st_<wbr>cb_viewport.c<br>
index ff18fd0..2158c55 100644<br>
--- a/src/mesa/state_tracker/st_<wbr>cb_viewport.c<br>
+++ b/src/mesa/state_tracker/st_<wbr>cb_viewport.c<br>
@@ -47,20 +47,20 @@ static void st_viewport(struct gl_context *ctx)<br>
/*<br>
* Normally we'd want the state tracker manager to mark the drawables<br>
* invalid only when needed. This will force the state tracker manager<br>
* to revalidate the drawable, rather than just update the context with<br>
* the latest cached drawable info.<br>
*/<br>
<br>
stdraw = st_ws_framebuffer(st->ctx-><wbr>DrawBuffer);<br>
stread = st_ws_framebuffer(st->ctx-><wbr>ReadBuffer);<br>
<br>
- if (stdraw && stdraw->iface)<br>
+ if (stdraw)<br>
stdraw->iface_stamp = p_atomic_read(&stdraw->iface-><wbr>stamp) - 1;<br>
- if (stread && stread != stdraw && stread->iface)<br>
+ if (stread && stread != stdraw && stread)<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">Checking stread twice? With that fixed, the series is:</div><div dir="auto"><br></div><div dir="auto">Reviewed-by: Marek Olšák <marek@olsak@<a href="http://amd.com">amd.com</a>></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
stread->iface_stamp = p_atomic_read(&stread->iface-><wbr>stamp) - 1;<br>
}<br>
<br>
void st_init_viewport_functions(<wbr>struct dd_function_table *functions)<br>
{<br>
functions->Viewport = st_viewport;<br>
}<br>
diff --git a/src/mesa/state_tracker/st_<wbr>manager.c b/src/mesa/state_tracker/st_<wbr>manager.c<br>
index 2ba7de6..90e4177 100644<br>
--- a/src/mesa/state_tracker/st_<wbr>manager.c<br>
+++ b/src/mesa/state_tracker/st_<wbr>manager.c<br>
@@ -169,24 +169,20 @@ st_context_validate(struct st_context *st,<br>
static void<br>
st_framebuffer_validate(struct st_framebuffer *stfb,<br>
struct st_context *st)<br>
{<br>
struct pipe_resource *textures[ST_ATTACHMENT_COUNT]<wbr>;<br>
uint width, height;<br>
unsigned i;<br>
boolean changed = FALSE;<br>
int32_t new_stamp;<br>
<br>
- /* Check for incomplete framebuffers (e.g. EGL_KHR_surfaceless_context) */<br>
- if (!stfb->iface)<br>
- return;<br>
-<br>
new_stamp = p_atomic_read(&stfb->iface-><wbr>stamp);<br>
if (stfb->iface_stamp == new_stamp)<br>
return;<br>
<br>
/* validate the fb */<br>
do {<br>
if (!stfb->iface->validate(&st-><wbr>iface, stfb->iface, stfb->statts,<br>
stfb->num_statts, textures))<br>
return;<br>
<br>
@@ -274,23 +270,20 @@ st_framebuffer_update_<wbr>attachments(struct st_framebuffer *stfb)<br>
* corresponds to a window and is not a user-created FBO.<br>
*/<br>
static boolean<br>
st_framebuffer_add_<wbr>renderbuffer(struct st_framebuffer *stfb,<br>
gl_buffer_index idx)<br>
{<br>
struct gl_renderbuffer *rb;<br>
enum pipe_format format;<br>
boolean sw;<br>
<br>
- if (!stfb->iface)<br>
- return FALSE;<br>
-<br>
assert(_mesa_is_winsys_fbo(&<wbr>stfb->Base));<br>
<br>
/* do not distinguish depth/stencil buffers */<br>
if (idx == BUFFER_STENCIL)<br>
idx = BUFFER_DEPTH;<br>
<br>
switch (idx) {<br>
case BUFFER_DEPTH:<br>
format = stfb->iface->visual->depth_<wbr>stencil_format;<br>
sw = FALSE;<br>
<font color="#888888">--<br>
2.9.3<br>
<br>
______________________________<wbr>_________________<br>
mesa-stable mailing list<br>
<a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.freedesktop.<wbr>org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-stable" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-stable</a><br>
</font></blockquote></div><br></div></div></div>