[Mesa-dev] [PATCH v2 2/2] i965: Fix invalid pointer read in dead_control_flow_eliminate().

Jason Ekstrand jason at jlekstrand.net
Mon Apr 4 07:19:57 UTC 2016


On Sun, Apr 3, 2016 at 10:56 PM, Kenneth Graunke <kenneth at whitecape.org>
wrote:

> There may not be a previous block.  In this case, there's no real work
> to do, so just continue on to the next one.
>
> v2: Update for bblock->prev() API change.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
> b/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
> index 2c1abaf..114dc6c 100644
> --- a/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
> @@ -42,6 +42,10 @@ dead_control_flow_eliminate(backend_shader *s)
>
>     foreach_block_safe (block, s->cfg) {
>        bblock_t *prev_block = block->prev();
> +
> +      if (!prev_block)
> +         continue;
> +
>        backend_instruction *const inst = block->start();
>        backend_instruction *const prev_inst = prev_block->end();
>

Yeah, that guy right there will be a problem on the first loop iteration
every time.  I've seen this in valgrind quite a bit lately.  Thanks for
fixing it!

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

Maybe Cc stable?
--Jason


>
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160404/22b66c3e/attachment.html>


More information about the mesa-dev mailing list