[PATCH] xace: Invalid reference to out-of-scope data.

Alan Coopersmith alan.coopersmith at oracle.com
Tue Aug 10 07:21:11 PDT 2010


Chris Wilson wrote:
> The callback data passed by reference to the hook was allocated on stack
> within the scope of the case statement. The compiler is free to reuse
> any of that stack space whilst making the function call so we may end up
> passing garbage into the callback.

Did the hw/xfree86/modes/xf86Crtc.c hunk sneak in by mistake?   Seems unrelated:

> diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
> index b2daec7..3cbaa08 100644
> --- a/hw/xfree86/modes/xf86Crtc.c
> +++ b/hw/xfree86/modes/xf86Crtc.c
> @@ -1393,7 +1393,13 @@ xf86ModeCompare (DisplayModePtr a, DisplayModePtr b)
>      if (diff)
>  	return diff;
>      diff = b->Clock - a->Clock;
> -    return diff;
> +    if (diff)
> +	    return diff;
> +    if (a->Private)
> +	    return -1;
> +    if (b->Private)
> +	    return 1;
> +    return 0;
>  }
>  
>  /**


-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list