mirror of
https://gitlab.freedesktop.org/xorg/lib/libx11.git
synced 2026-05-06 03:28:01 +02:00
Fix out-of-range comparison in _XF86BigfontQueryFont
clang complained (correctly): warning: comparison of constant 768614336404564650 with expression of type 'CARD32' (aka 'unsigned int') is always true [-Wtautological-constant-out-of-range-compare] [While LONG_MAX is correct, since it's used in size_t math, the numbers have to be limited to 32-bit range to be usable by 32-bit clients, and values beyond that range are far more likely to be bugs in the data from the server than valid numbers of characters in a font. -alan- ] Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
parent
383e2b0d02
commit
6d926088d8
1 changed files with 1 additions and 1 deletions
|
|
@ -588,7 +588,7 @@ _XF86BigfontQueryFont (
|
|||
if (!(extcodes->serverCapabilities & CAP_VerifiedLocal)) {
|
||||
struct shmid_ds buf;
|
||||
if (!(shmctl(reply.shmid, IPC_STAT, &buf) >= 0
|
||||
&& reply.nCharInfos < (LONG_MAX / sizeof(XCharStruct))
|
||||
&& reply.nCharInfos < (INT_MAX / sizeof(XCharStruct))
|
||||
&& buf.shm_segsz >= reply.shmsegoffset + reply.nCharInfos * sizeof(XCharStruct) + sizeof(CARD32)
|
||||
&& *(CARD32 *)(addr + reply.shmsegoffset + reply.nCharInfos * sizeof(XCharStruct)) == extcodes->serverSignature)) {
|
||||
shmdt(addr);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue