mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-20 03:30:04 +01:00
dix: set errorValue correctly when XID lookup fails in ChangeGCXIDs()
dixLookupResourceByType always overwrites the pointer passed in as the
first arg, so we shouldn't use the union it's in after that to get the
requested XID value to put in the errorValue.
Closes: #1857
Fixes: 2d7eb4a19 ("Pre-validate ChangeGC XIDs.")
Reported-by: Mouse <mouse@Rodents-Montreal.ORG>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2111>
This commit is contained in:
parent
eccee47185
commit
ac42c39145
1 changed files with 5 additions and 2 deletions
7
dix/gc.c
7
dix/gc.c
|
|
@ -442,6 +442,7 @@ ChangeGCXIDs(ClientPtr client, GC * pGC, BITS32 mask, CARD32 *pC32)
|
||||||
vals[i].val = pC32[i];
|
vals[i].val = pC32[i];
|
||||||
for (i = 0; i < ARRAY_SIZE(xidfields); ++i) {
|
for (i = 0; i < ARRAY_SIZE(xidfields); ++i) {
|
||||||
int offset, rc;
|
int offset, rc;
|
||||||
|
XID id;
|
||||||
|
|
||||||
if (!(mask & xidfields[i].mask))
|
if (!(mask & xidfields[i].mask))
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -450,11 +451,13 @@ ChangeGCXIDs(ClientPtr client, GC * pGC, BITS32 mask, CARD32 *pC32)
|
||||||
vals[offset].ptr = NullPixmap;
|
vals[offset].ptr = NullPixmap;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
rc = dixLookupResourceByType(&vals[offset].ptr, vals[offset].val,
|
/* save the id, since dixLookupResourceByType overwrites &vals[offset] */
|
||||||
|
id = vals[offset].val;
|
||||||
|
rc = dixLookupResourceByType(&vals[offset].ptr, id,
|
||||||
xidfields[i].type, client,
|
xidfields[i].type, client,
|
||||||
xidfields[i].access_mode);
|
xidfields[i].access_mode);
|
||||||
if (rc != Success) {
|
if (rc != Success) {
|
||||||
client->errorValue = vals[offset].val;
|
client->errorValue = id;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue