mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-20 04:40:02 +01:00
xkb: Prevent overflow in XkbSetCompatMap()
The XkbCompatMap structure stores its "num_si" and "size_si" fields using an unsigned short. However, the function _XkbSetCompatMap() will store the sum of the input data "firstSI" and "nSI" in both XkbCompatMap's "num_si" and "size_si" without first checking if the sum overflows the maximum unsigned short value, leading to a possible overflow. To avoid the issue, check whether the sum does not exceed the maximum unsigned short value, or return a "BadValue" error otherwise. CVE-2025-62231, ZDI-CAN-27560 This vulnerability was discovered by: Jan-Niklas Sohn working with Trend Micro Zero Day Initiative Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2086>
This commit is contained in:
parent
10c94238bd
commit
475d9f49ac
1 changed files with 2 additions and 0 deletions
|
|
@ -2990,6 +2990,8 @@ _XkbSetCompatMap(ClientPtr client, DeviceIntPtr dev,
|
||||||
XkbSymInterpretPtr sym;
|
XkbSymInterpretPtr sym;
|
||||||
unsigned int skipped = 0;
|
unsigned int skipped = 0;
|
||||||
|
|
||||||
|
if ((unsigned) (req->firstSI + req->nSI) > USHRT_MAX)
|
||||||
|
return BadValue;
|
||||||
if ((unsigned) (req->firstSI + req->nSI) > compat->size_si) {
|
if ((unsigned) (req->firstSI + req->nSI) > compat->size_si) {
|
||||||
compat->num_si = compat->size_si = req->firstSI + req->nSI;
|
compat->num_si = compat->size_si = req->firstSI + req->nSI;
|
||||||
compat->sym_interpret = reallocarray(compat->sym_interpret,
|
compat->sym_interpret = reallocarray(compat->sym_interpret,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue