[PATCH v2 1/7] xkb: Check for unsuported comibnation of action for XkbSetMap

Peter Hutterer peter.hutterer at who-t.net
Wed Jul 28 18:22:55 PDT 2010


typo in the subject line btw.

On Wed, Jul 28, 2010 at 10:47:01PM +0300, Pauli Nieminen wrote:
> This prevents validation code from using unitialized values. Validation
> code depends on the previous step to produce lookup table for the next step.
> 
> Fixes:
> Using uninitialized element of array "symsPerKey" in call to function
> "CheckKeyActions"
> Using uninitialized element of array "mapWidths" in call to function
> "CheckKeySyms"
> 
> Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
> ---
> 
> Improved commit message
> 
>  xkb/xkb.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/xkb/xkb.c b/xkb/xkb.c
> index 4105c1c..618d0bc 100644
> --- a/xkb/xkb.c
> +++ b/xkb/xkb.c
> @@ -2367,6 +2367,14 @@ _XkbSetMapChecks(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq *req, char* va
>  	}
>      }

two things:
can you add the comment in your reply email to the original patch into the
code? it explains the reason best, so having it here makes the code much
more understandable.

and initializing symsPerKey and mapWidths to 0 will be useful too to spot
errors down the road.

> +    if ((!(req->present & XkbKeySymsMask) &&
> +	    (req->present & XkbKeyActionsMask)) ||
> +	(!(req->present & XkbKeyTypesMask) &&
> +	    (req->present & XkbKeySymsMask))) {
> +	client->errorValue = req->present;
> +	return BadMatch;
> +    }
> +
>      if ((req->present & XkbKeyTypesMask) &&
>  	(!CheckKeyTypes(client,xkb,req,(xkbKeyTypeWireDesc **)&values,
>  						&nTypes,mapWidths))) {
> -- 
> 1.6.3.3


with those changes and for the other patches Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
 
Cheers,
  Peter


More information about the xorg-devel mailing list