[PATCH libXrandr] add parameter check

Leif Middelschulte leif.middelschulte at gmail.com
Tue May 25 19:55:40 PDT 2010


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
>>
>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libXrandr-add-parameter-safety-check.patch
Type: text/x-patch
Size: 1010 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20100525/24ae161c/attachment.bin>


More information about the xorg-devel mailing list