Module Name:    xsrc
Committed By:   christos
Date:           Thu Nov 14 00:11:12 UTC 2013

Modified Files:
        xsrc/external/mit/xf86-video-intel/dist/src: i810_dri.c

Log Message:
CID 1107540: Make the code safe avoiding random stack access. In the first
loop where there is a singleton point to pptSrc, only access that singleton,
no matter what.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
    xsrc/external/mit/xf86-video-intel/dist/src/i810_dri.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xf86-video-intel/dist/src/i810_dri.c
diff -u xsrc/external/mit/xf86-video-intel/dist/src/i810_dri.c:1.3 xsrc/external/mit/xf86-video-intel/dist/src/i810_dri.c:1.4
--- xsrc/external/mit/xf86-video-intel/dist/src/i810_dri.c:1.3	Wed Nov 13 16:48:25 2013
+++ xsrc/external/mit/xf86-video-intel/dist/src/i810_dri.c	Wed Nov 13 19:11:12 2013
@@ -1245,10 +1245,17 @@ I810DRIMoveBuffers(WindowPtr pParent, DD
 	    while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1))
 	       pboxNext--;
 	    pboxTmp = pboxNext + 1;
-	    pptTmp = pptSrc + (pboxTmp - pbox);
-	    while (pboxTmp <= pboxBase) {
-	       *pboxNew1++ = *pboxTmp++;
-	       *pptNew1++ = *pptTmp++;
+	    if (pptSrc == &ptOldOrg) {
+		if (pboxTmp <= pboxBase) {
+	          *pboxNew1++ = *pboxTmp;
+	          *pptNew1++ = *pptSrc;
+		}
+	    } else {
+	       pptTmp = pptSrc + (pboxTmp - pbox);
+	       while (pboxTmp <= pboxBase) {
+	          *pboxNew1++ = *pboxTmp++;
+	          *pptNew1++ = *pptTmp++;
+	       }
 	    }
 	    pboxBase = pboxNext;
 	 }

Reply via email to