[PATCH 1/9] render: warning fixes

Keith Packard keithp at keithp.com
Tue Oct 19 11:16:00 PDT 2010


On Tue, 19 Oct 2010 13:58:56 -0400, Adam Jackson <ajax at redhat.com> wrote:

> I read this as saying that comparison between void * is legal since they
> have compatible types, and does the expected thing as long as you
> haven't coerced the object across address spaces.

Seems ambiguous to me -- you can't do pointer arithmetic on void *
pointers (except in GCC). It's probably fine, but one worries about
non-GCC compilers (at least a little bit). How about:

ndex 00241f9..a14e9b0 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1079,8 +1079,8 @@ ProcRenderAddGlyphs (ClientPtr client)
     remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
 
     /* protect against bad nglyphs */
-    if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
-        bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+    if (gi < (xGlyphInfo *) stuff || gi > (xGlyphInfo *) ((CARD32 *)stuff + client->req_len) ||
+        bits < (CARD8 *) stuff || bits > (CARD8 *) ((CARD32 *)stuff + client->req_len)) {
         err = BadLength;
         goto bail;
     }


-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20101019/6338a64c/attachment.pgp>


More information about the xorg-devel mailing list