HI

I'm getting a error building xorg-server-1.14.1.902 with thelatest snapshot
of gcc-4.8:

kinput.c:225:43: error: array subscript is above array bounds
[-Werror=array-bounds]

This is because kdNumInputFds can become equal to KD_MAX_INPUT_FDS in
KdRegisterFd(). This means that in KdUnregisterFd(), kdInputFds[j + 1] can
be beyond the end of the array.

The patch below fixes the error.

Signed-off-by: Chris Clayton <[email protected]>
---
--- xorg-server-1.14.1.902/hw/kdrive/src/kinput.c~      2013-06-14
21:22:31.000000000 +0100
+++ xorg-server-1.14.1.902/hw/kdrive/src/kinput.c       2013-06-14
21:47:21.000000000 +0100
@@ -221,7 +221,7 @@
             if (do_close)
                 close(kdInputFds[i].fd);
             kdNumInputFds--;
-            for (j = i; j < kdNumInputFds; j++)
+            for (j = i; j < (kdNumInputFds - 1); j++)
                 kdInputFds[j] = kdInputFds[j + 1];
             break;
         }
---
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to