Module Name: xsrc
Committed By: christos
Date: Mon Jun 3 22:44:40 UTC 2013
Modified Files:
xsrc/external/mit/xf86-video-openchrome/dist/src: via_display.c
Log Message:
PR/47884: Brad Harder: Avoid variable stack allocation, use malloc for SSP.
To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 \
xsrc/external/mit/xf86-video-openchrome/dist/src/via_display.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-openchrome/dist/src/via_display.c
diff -u xsrc/external/mit/xf86-video-openchrome/dist/src/via_display.c:1.1.1.2 xsrc/external/mit/xf86-video-openchrome/dist/src/via_display.c:1.2
--- xsrc/external/mit/xf86-video-openchrome/dist/src/via_display.c:1.1.1.2 Sat Jun 1 17:08:53 2013
+++ xsrc/external/mit/xf86-video-openchrome/dist/src/via_display.c Mon Jun 3 18:44:40 2013
@@ -1002,9 +1002,13 @@ iga1_crtc_gamma_set(xf86CrtcPtr crtc, CA
vgaHWPtr hwp = VGAHWPTR(pScrn);
VIAPtr pVia = VIAPTR(pScrn);
int SR1A, SR1B, CR67, CR6A;
- LOCO colors[size];
+ LOCO *colors;
int i;
+ colors = malloc(size * sizeof(*colors));
+ if (colors == NULL)
+ return;
+
for (i = 0; i < size; i++) {
colors[i].red = red[i] >> 8;
colors[i].green = green[i] >> 8;
@@ -1039,6 +1043,7 @@ iga1_crtc_gamma_set(xf86CrtcPtr crtc, CA
hwp->writeDacData(hwp, colors[i].blue);
}
}
+ free(colors);
}
static void *
@@ -1413,8 +1418,12 @@ iga2_crtc_gamma_set(xf86CrtcPtr crtc, CA
vgaHWPtr hwp = VGAHWPTR(pScrn);
VIAPtr pVia = VIAPTR(pScrn);
int SR1A, SR1B, CR67, CR6A;
- LOCO colors[size];
int i;
+ LOCO *colors;
+
+ colors = malloc(size * sizeof(*colors));
+ if (colors == NULL)
+ return;
for (i = 0; i < size; i++) {
colors[i].red = red[i] >> 8;
@@ -1473,6 +1482,7 @@ iga2_crtc_gamma_set(xf86CrtcPtr crtc, CA
hwp->writeDacData(hwp, colors[i].blue);
}
}
+ free(colors);
}
static void *