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

Matt Turner mattst88 at gmail.com
Wed Mar 30 20:10:45 UTC 2016


On Wed, Mar 30, 2016 at 12:50 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.
>
> 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..116a6c7 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->link.is_head_sentinel())
> +         continue;
> +

Oh, wow.

Reviewed-by: Matt Turner <mattst88 at gmail.com>


More information about the mesa-dev mailing list