<p dir="ltr">Sounds good, is there a protocol to signify a patch isn't active anymore?</p>
<div class="gmail_quot<blockquote class=" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 03/09/2016 04:37 PM, Lars Hamre wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have not been able to force a NULL dereference, this is based off<br>
analyzing the code.<br>
Yes that is implicitly true, but if at some point the implicit<br>
relationship is broken, I would<br>
rather not have a NULL dereference.<br>
<br>
If you do not agree, I am fine deferring to your judgement!<br>
</blockquote>
<br>
I don't think the code in question will be hit if texObj is null.<br>
<br>
This code is pretty old (perhaps 15 years) but has been used a lot. I think we'd have known by now if there was a null pointer problem.<br>
<br>
-Brian<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
On Wed, Mar 9, 2016 at 6:23 PM, Ian Romanick <<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a><br>
<mailto:<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>>> wrote:<br>
<br>
On 03/09/2016 10:21 AM, Lars Hamre wrote:<br>
> Fixes a possible null dereference.<br>
><br>
> NOTE: this is my first time contributing, please let me know if I<br>
> should be doing anything differently, thanks!<br>
><br>
> Signed-off-by: Lars Hamre <<a href="mailto:chemecse@gmail.com" target="_blank">chemecse@gmail.com</a><br>
<mailto:<a href="mailto:chemecse@gmail.com" target="_blank">chemecse@gmail.com</a>>><br>
> ---<br>
> src/mesa/swrast/s_triangle.c | 7 ++++---<br>
> 1 file changed, 4 insertions(+), 3 deletions(-)<br>
><br>
> diff --git a/src/mesa/swrast/s_triangle.c<br>
b/src/mesa/swrast/s_triangle.c<br>
> index 876a74b..9225974 100644<br>
> --- a/src/mesa/swrast/s_triangle.c<br>
> +++ b/src/mesa/swrast/s_triangle.c<br>
> @@ -781,7 +781,7 @@ fast_persp_span(struct gl_context *ctx,<br>
SWspan *span,<br>
> }<br>
> break;<br>
> }<br>
> -<br>
> +<br>
> assert(span->arrayMask & SPAN_RGBA);<br>
> _swrast_write_rgba_span(ctx, span);<br>
><br>
> @@ -1063,8 +1063,8 @@ _swrast_choose_triangle( struct gl_context<br>
*ctx )<br>
> swImg = swrast_texture_image_const(texImg);<br>
><br>
> format = texImg ? texImg->TexFormat : MESA_FORMAT_NONE;<br>
> - minFilter = texObj2D ? samp->MinFilter : GL_NONE;<br>
> - magFilter = texObj2D ? samp->MagFilter : GL_NONE;<br>
> + minFilter = (texObj2D && samp) ? samp->MinFilter : GL_NONE;<br>
> + magFilter = (texObj2D && samp) ? samp->MagFilter : GL_NONE;<br>
<br>
NAK this hunk. If texObj2D is not NULL, samp is also not NULL.<br>
<br>
> envMode = ctx->Texture.Unit[0].EnvMode;<br>
><br>
> /* First see if we can use an optimized 2-D texture function */<br>
> @@ -1073,6 +1073,7 @@ _swrast_choose_triangle( struct gl_context *ctx )<br>
> && !ctx->ATIFragmentShader._Enabled<br>
> && ctx->Texture._MaxEnabledTexImageUnit == 0<br>
> && ctx->Texture.Unit[0]._Current->Target == GL_TEXTURE_2D<br>
> + && samp<br>
<br>
I think the 'ctx->Texture.Unit[0]._Current->Target == GL_TEXTURE_2D'<br>
implicitly ensures that samp cannot be NULL. Have you been able to<br>
cause a NULL dereference in this code path or is this just based on<br>
speculation?<br>
<br>
> && samp->WrapS == GL_REPEAT<br>
> && samp->WrapT == GL_REPEAT<br>
> && texObj2D->_Swizzle == SWIZZLE_NOOP<br>
> --<br>
> 2.5.0<br>
><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<mailto:<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a>><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
<br>
</blockquote>
<br>
</div>