[PATCH libXrandr] add parameter check

Peter Hutterer peter.hutterer at who-t.net
Tue May 25 18:47:09 PDT 2010


On Tue, May 25, 2010 at 03:09:15PM -0300, Leif Middelschulte wrote:
> Attached patch fixes SEGV when calling a function with 'wrong' parameters.
> 
> BR,
> 
> Leif Middelschulte

> From 4b98304a1da9f0cc04cc0a2d0bb9a0779b43b494 Mon Sep 17 00:00:00 2001
> From: Leif Middelschulte <leif.middelschulte at gmail.com>
> Date: Tue, 25 May 2010 14:52:50 -0300
> Subject: [PATCH] libXrandr: adds parameter safety check
> 
> As mentioned in bugzilla ticket 28150.
> Calling '_XRRValidateCache' with 'improper' arguments results in a SEGV.
> This patch adds a parameter validation to the mentioned function.
> 
> Signed-off-by: Leif Middelschulte <leif.middelschulte at gmail.com>
> ---
>  src/XrrConfig.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/XrrConfig.c b/src/XrrConfig.c
> index 34ff3ef..af9cf4e 100644
> --- a/src/XrrConfig.c
> +++ b/src/XrrConfig.c
> @@ -105,7 +105,7 @@ static XRRScreenConfiguration *_XRRValidateCache (Display *dpy,
>      XRRScreenConfiguration **configs;
>      XRandRInfo *xrri;
>  
> -    if (XextHasExtension(info)) {
> +    if ( (screen > 0) && (screen < ScreenCount(dpy)) && XextHasExtension(info)) {

(just looking at this hunk, don't know the code)
shouldn't this be screen >= 0?

Cheers,
  Peter

>  	xrri = (XRandRInfo *) info->data;
>  	configs = xrri->config;
>  
> -- 
> 1.7.0.4
> 




More information about the xorg-devel mailing list