[PATCH libXrandr] add parameter check

Peter Hutterer peter.hutterer at who-t.net
Wed May 26 13:42:19 PDT 2010


On Tue, May 25, 2010 at 11:55:40PM -0300, Leif Middelschulte wrote:
> 2010/5/25 Peter Hutterer <peter.hutterer at who-t.net>:
> > 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?
> 
> Right, typo. sorry ;-) Find attached the corrected version. I also
> removed a whitspace.
> 
> Cheers,
> Leif
> >
> > Cheers,
> >  Peter
> >
> >>       xrri = (XRandRInfo *) info->data;
> >>       configs = xrri->config;
> >>
> >> --
> >> 1.7.0.4
> >>
> >
> >
> >

> From 81c628ea01a6be262bb21bd4320317e8a7b33ac1 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: add 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..793d8b6 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)) {
>  	xrri = (XRandRInfo *) info->data;
>  	configs = xrri->config;
>  
> -- 
> 1.7.0.4

pushed, thanks.

Cheers,
  Peter


More information about the xorg-devel mailing list