diff options
author | Thomas Klausner <wiz@NetBSD.org> | 2013-06-25 18:34:32 +0200 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-07-21 11:05:55 -0700 |
commit | 6d926088d80a08e13e6d6c4ff207b81ad52e667f (patch) | |
tree | 0d3e43565ddbfff83b67f82039e4062491348f13 /src | |
parent | 383e2b0d029482a0f4c39fe00e15397538576fc1 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/Font.c | 2 |
1 files changed, 1 insertions, 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); |