"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xkb/xkb.c" between
xorg-server-1.20.8.tar.bz2 and xorg-server-1.20.9.tar.bz2

About: The X.Org X Server component of the X Window System architecture.

xkb.c  (xorg-server-1.20.8.tar.bz2):xkb.c  (xorg-server-1.20.9.tar.bz2)
skipping to change at line 155 skipping to change at line 155
return er;\ return er;\
}\ }\
else if ( (first)<(r)->minKeyCode ) {\ else if ( (first)<(r)->minKeyCode ) {\
(ev)=_XkbErrCode3(err+1,(first),(r)->minKeyCode);\ (ev)=_XkbErrCode3(err+1,(first),(r)->minKeyCode);\
return er;\ return er;\
}\ }\
} }
#define CHK_REQ_KEY_RANGE(err,first,num,r) \ #define CHK_REQ_KEY_RANGE(err,first,num,r) \
CHK_REQ_KEY_RANGE2(err,first,num,r,client->errorValue,BadValue) CHK_REQ_KEY_RANGE2(err,first,num,r,client->errorValue,BadValue)
static Bool
_XkbCheckRequestBounds(ClientPtr client, void *stuff, void *from, void *to) {
char *cstuff = (char *)stuff;
char *cfrom = (char *)from;
char *cto = (char *)to;
return cfrom < cto &&
cfrom >= cstuff &&
cfrom < cstuff + ((size_t)client->req_len << 2) &&
cto >= cstuff &&
cto <= cstuff + ((size_t)client->req_len << 2);
}
/***====================================================================***/ /***====================================================================***/
int int
ProcXkbUseExtension(ClientPtr client) ProcXkbUseExtension(ClientPtr client)
{ {
REQUEST(xkbUseExtensionReq); REQUEST(xkbUseExtensionReq);
xkbUseExtensionReply rep; xkbUseExtensionReply rep;
int supported; int supported;
REQUEST_SIZE_MATCH(xkbUseExtensionReq); REQUEST_SIZE_MATCH(xkbUseExtensionReq);
skipping to change at line 4048 skipping to change at line 4061
xkb->map->num_types) { xkb->map->num_types) {
client->errorValue = client->errorValue =
_XkbErrCode4(0x03, stuff->firstType, stuff->nTypes, _XkbErrCode4(0x03, stuff->firstType, stuff->nTypes,
xkb->map->num_types); xkb->map->num_types);
return BadValue; return BadValue;
} }
if (((unsigned) stuff->firstType) <= XkbLastRequiredType) { if (((unsigned) stuff->firstType) <= XkbLastRequiredType) {
client->errorValue = _XkbErrCode2(0x04, stuff->firstType); client->errorValue = _XkbErrCode2(0x04, stuff->firstType);
return BadAccess; return BadAccess;
} }
if (!_XkbCheckRequestBounds(client, stuff, tmp, tmp + stuff->nTypes))
return BadLength;
old = tmp; old = tmp;
tmp = _XkbCheckAtoms(tmp, stuff->nTypes, client->swapped, &bad); tmp = _XkbCheckAtoms(tmp, stuff->nTypes, client->swapped, &bad);
if (!tmp) { if (!tmp) {
client->errorValue = bad; client->errorValue = bad;
return BadAtom; return BadAtom;
} }
for (i = 0; i < stuff->nTypes; i++, old++) { for (i = 0; i < stuff->nTypes; i++, old++) {
if (!_XkbCheckTypeName((Atom) *old, stuff->firstType + i)) if (!_XkbCheckTypeName((Atom) *old, stuff->firstType + i))
client->errorValue = _XkbErrCode2(0x05, i); client->errorValue = _XkbErrCode2(0x05, i);
} }
skipping to change at line 4077 skipping to change at line 4092
} }
if ((unsigned) (stuff->firstKTLevel + stuff->nKTLevels - 1) >= if ((unsigned) (stuff->firstKTLevel + stuff->nKTLevels - 1) >=
xkb->map->num_types) { xkb->map->num_types) {
client->errorValue = _XkbErrCode4(0x06, stuff->firstKTLevel, client->errorValue = _XkbErrCode4(0x06, stuff->firstKTLevel,
stuff->nKTLevels, stuff->nKTLevels,
xkb->map->num_types); xkb->map->num_types);
return BadValue; return BadValue;
} }
width = (CARD8 *) tmp; width = (CARD8 *) tmp;
tmp = (CARD32 *) (((char *) tmp) + XkbPaddedSize(stuff->nKTLevels)); tmp = (CARD32 *) (((char *) tmp) + XkbPaddedSize(stuff->nKTLevels));
if (!_XkbCheckRequestBounds(client, stuff, width, tmp))
return BadLength;
type = &xkb->map->types[stuff->firstKTLevel]; type = &xkb->map->types[stuff->firstKTLevel];
for (i = 0; i < stuff->nKTLevels; i++, type++) { for (i = 0; i < stuff->nKTLevels; i++, type++) {
if (width[i] == 0) if (width[i] == 0)
continue; continue;
else if (width[i] != type->num_levels) { else if (width[i] != type->num_levels) {
client->errorValue = _XkbErrCode4(0x07, i + stuff->firstKTLevel, client->errorValue = _XkbErrCode4(0x07, i + stuff->firstKTLevel,
type->num_levels, width[i]); type->num_levels, width[i]);
return BadMatch; return BadMatch;
} }
if (!_XkbCheckRequestBounds(client, stuff, tmp, tmp + width[i]))
return BadLength;
tmp = _XkbCheckAtoms(tmp, width[i], client->swapped, &bad); tmp = _XkbCheckAtoms(tmp, width[i], client->swapped, &bad);
if (!tmp) { if (!tmp) {
client->errorValue = bad; client->errorValue = bad;
return BadAtom; return BadAtom;
} }
} }
} }
if (stuff->which & XkbIndicatorNamesMask) { if (stuff->which & XkbIndicatorNamesMask) {
if (stuff->indicators == 0) { if (stuff->indicators == 0) {
client->errorValue = 0x08; client->errorValue = 0x08;
return BadMatch; return BadMatch;
} }
if (!_XkbCheckRequestBounds(client, stuff, tmp,
tmp + Ones(stuff->indicators)))
return BadLength;
tmp = _XkbCheckMaskedAtoms(tmp, XkbNumIndicators, stuff->indicators, tmp = _XkbCheckMaskedAtoms(tmp, XkbNumIndicators, stuff->indicators,
client->swapped, &bad); client->swapped, &bad);
if (!tmp) { if (!tmp) {
client->errorValue = bad; client->errorValue = bad;
return BadAtom; return BadAtom;
} }
} }
if (stuff->which & XkbVirtualModNamesMask) { if (stuff->which & XkbVirtualModNamesMask) {
if (stuff->virtualMods == 0) { if (stuff->virtualMods == 0) {
client->errorValue = 0x09; client->errorValue = 0x09;
return BadMatch; return BadMatch;
} }
if (!_XkbCheckRequestBounds(client, stuff, tmp,
tmp + Ones(stuff->virtualMods)))
return BadLength;
tmp = _XkbCheckMaskedAtoms(tmp, XkbNumVirtualMods, tmp = _XkbCheckMaskedAtoms(tmp, XkbNumVirtualMods,
(CARD32) stuff->virtualMods, (CARD32) stuff->virtualMods,
client->swapped, &bad); client->swapped, &bad);
if (!tmp) { if (!tmp) {
client->errorValue = bad; client->errorValue = bad;
return BadAtom; return BadAtom;
} }
} }
if (stuff->which & XkbGroupNamesMask) { if (stuff->which & XkbGroupNamesMask) {
if (stuff->groupNames == 0) { if (stuff->groupNames == 0) {
client->errorValue = 0x0a; client->errorValue = 0x0a;
return BadMatch; return BadMatch;
} }
if (!_XkbCheckRequestBounds(client, stuff, tmp,
tmp + Ones(stuff->groupNames)))
return BadLength;
tmp = _XkbCheckMaskedAtoms(tmp, XkbNumKbdGroups, tmp = _XkbCheckMaskedAtoms(tmp, XkbNumKbdGroups,
(CARD32) stuff->groupNames, (CARD32) stuff->groupNames,
client->swapped, &bad); client->swapped, &bad);
if (!tmp) { if (!tmp) {
client->errorValue = bad; client->errorValue = bad;
return BadAtom; return BadAtom;
} }
} }
if (stuff->which & XkbKeyNamesMask) { if (stuff->which & XkbKeyNamesMask) {
if (stuff->firstKey < (unsigned) xkb->min_key_code) { if (stuff->firstKey < (unsigned) xkb->min_key_code) {
skipping to change at line 4144 skipping to change at line 4172
stuff->firstKey); stuff->firstKey);
return BadValue; return BadValue;
} }
if (((unsigned) (stuff->firstKey + stuff->nKeys - 1) > if (((unsigned) (stuff->firstKey + stuff->nKeys - 1) >
xkb->max_key_code) || (stuff->nKeys < 1)) { xkb->max_key_code) || (stuff->nKeys < 1)) {
client->errorValue = client->errorValue =
_XkbErrCode4(0x0c, xkb->max_key_code, stuff->firstKey, _XkbErrCode4(0x0c, xkb->max_key_code, stuff->firstKey,
stuff->nKeys); stuff->nKeys);
return BadValue; return BadValue;
} }
if (!_XkbCheckRequestBounds(client, stuff, tmp, tmp + stuff->nKeys))
return BadLength;
tmp += stuff->nKeys; tmp += stuff->nKeys;
} }
if ((stuff->which & XkbKeyAliasesMask) && (stuff->nKeyAliases > 0)) { if ((stuff->which & XkbKeyAliasesMask) && (stuff->nKeyAliases > 0)) {
if (!_XkbCheckRequestBounds(client, stuff, tmp,
tmp + (stuff->nKeyAliases * 2)))
return BadLength;
tmp += stuff->nKeyAliases * 2; tmp += stuff->nKeyAliases * 2;
} }
if (stuff->which & XkbRGNamesMask) { if (stuff->which & XkbRGNamesMask) {
if (stuff->nRadioGroups < 1) { if (stuff->nRadioGroups < 1) {
client->errorValue = _XkbErrCode2(0x0d, stuff->nRadioGroups); client->errorValue = _XkbErrCode2(0x0d, stuff->nRadioGroups);
return BadValue; return BadValue;
} }
if (!_XkbCheckRequestBounds(client, stuff, tmp,
tmp + stuff->nRadioGroups))
return BadLength;
tmp = _XkbCheckAtoms(tmp, stuff->nRadioGroups, client->swapped, &bad); tmp = _XkbCheckAtoms(tmp, stuff->nRadioGroups, client->swapped, &bad);
if (!tmp) { if (!tmp) {
client->errorValue = bad; client->errorValue = bad;
return BadAtom; return BadAtom;
} }
} }
if ((tmp - ((CARD32 *) stuff)) != stuff->length) { if ((tmp - ((CARD32 *) stuff)) != stuff->length) {
client->errorValue = stuff->length; client->errorValue = stuff->length;
return BadLength; return BadLength;
} }
skipping to change at line 4347 skipping to change at line 4383
if (!(client->xkbClientFlags & _XkbClientInitialized)) if (!(client->xkbClientFlags & _XkbClientInitialized))
return BadAccess; return BadAccess;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess); CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
CHK_MASK_LEGAL(0x01, stuff->which, XkbAllNamesMask); CHK_MASK_LEGAL(0x01, stuff->which, XkbAllNamesMask);
/* check device-independent stuff */ /* check device-independent stuff */
tmp = (CARD32 *) &stuff[1]; tmp = (CARD32 *) &stuff[1];
if (!_XkbCheckRequestBounds(client, stuff, tmp, tmp + 1))
return BadLength;
if (stuff->which & XkbKeycodesNameMask) { if (stuff->which & XkbKeycodesNameMask) {
tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad); tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad);
if (!tmp) { if (!tmp) {
client->errorValue = bad; client->errorValue = bad;
return BadAtom; return BadAtom;
} }
} }
if (!_XkbCheckRequestBounds(client, stuff, tmp, tmp + 1))
return BadLength;
if (stuff->which & XkbGeometryNameMask) { if (stuff->which & XkbGeometryNameMask) {
tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad); tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad);
if (!tmp) { if (!tmp) {
client->errorValue = bad; client->errorValue = bad;
return BadAtom; return BadAtom;
} }
} }
if (!_XkbCheckRequestBounds(client, stuff, tmp, tmp + 1))
return BadLength;
if (stuff->which & XkbSymbolsNameMask) { if (stuff->which & XkbSymbolsNameMask) {
tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad); tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad);
if (!tmp) { if (!tmp) {
client->errorValue = bad; client->errorValue = bad;
return BadAtom; return BadAtom;
} }
} }
if (!_XkbCheckRequestBounds(client, stuff, tmp, tmp + 1))
return BadLength;
if (stuff->which & XkbPhysSymbolsNameMask) { if (stuff->which & XkbPhysSymbolsNameMask) {
tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad); tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad);
if (!tmp) { if (!tmp) {
client->errorValue = bad; client->errorValue = bad;
return BadAtom; return BadAtom;
} }
} }
if (!_XkbCheckRequestBounds(client, stuff, tmp, tmp + 1))
return BadLength;
if (stuff->which & XkbTypesNameMask) { if (stuff->which & XkbTypesNameMask) {
tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad); tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad);
if (!tmp) { if (!tmp) {
client->errorValue = bad; client->errorValue = bad;
return BadAtom; return BadAtom;
} }
} }
if (!_XkbCheckRequestBounds(client, stuff, tmp, tmp + 1))
return BadLength;
if (stuff->which & XkbCompatNameMask) { if (stuff->which & XkbCompatNameMask) {
tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad); tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad);
if (!tmp) { if (!tmp) {
client->errorValue = bad; client->errorValue = bad;
return BadAtom; return BadAtom;
} }
} }
/* start of device-dependent tests */ /* start of device-dependent tests */
rc = _XkbSetNamesCheck(client, dev, stuff, tmp); rc = _XkbSetNamesCheck(client, dev, stuff, tmp);
 End of changes. 16 change blocks. 
0 lines changed or deleted 48 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)