[PATCH:libX11 4/4] Fix out-of-range comparison.
Thomas Klausner
wiz at NetBSD.org
Tue Jun 25 09:34:32 PDT 2013
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]
---
src/Font.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Font.c b/src/Font.c
index a32f740..ac18024 100644
--- a/src/Font.c
+++ b/src/Font.c
@@ -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);
--
1.8.3.1
More information about the xorg-devel
mailing list