summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-gfx/xv/files/xv-3.10a-bmpfix.patch')
-rw-r--r--media-gfx/xv/files/xv-3.10a-bmpfix.patch133
1 files changed, 133 insertions, 0 deletions
diff --git a/media-gfx/xv/files/xv-3.10a-bmpfix.patch b/media-gfx/xv/files/xv-3.10a-bmpfix.patch
new file mode 100644
index 000000000000..fabaa63e57dd
--- /dev/null
+++ b/media-gfx/xv/files/xv-3.10a-bmpfix.patch
@@ -0,0 +1,133 @@
+--- xv-3.10a/xvbmp.c
++++ xv-3.10a/xvbmp.c Mon Apr 11 18:45:16 2005
+@@ -190,14 +190,12 @@
+ bPad -= 12;
+ }
+
+- /* load up colormap, if any */
+- if (biBitCount==1 || biBitCount==4 || biBitCount==8) {
+- int i, cmaplen;
+-
+-/* this is superfluous; see identical test in "error checking" block above
+ if (biClrUsed > (1 << biBitCount))
+ biClrUsed = (1 << biBitCount);
+- */
++
++ /* load up colormap, if any */
++ if (biBitCount == 1 || biBitCount == 4 || biBitCount == 8) {
++ int i, cmaplen;
+
+ cmaplen = (biClrUsed) ? biClrUsed : 1 << biBitCount;
+ for (i=0; i<cmaplen; i++) {
+@@ -343,12 +341,13 @@
+ u_int w,h;
+ {
+ int i,j,c,bitnum,padw;
+- byte *pp;
++ byte *pp = pic8 + ((h - 1) * w);
++ size_t l = w*h;
+
+ c = 0;
+ padw = ((w + 31)/32) * 32; /* 'w', padded to be a multiple of 32 */
+
+- for (i=h-1; i>=0; i--) {
++ for (i=h-1; i>=0 && (pp - pic8 <= l); i--) {
+ pp = pic8 + (i * w);
+ if ((i&0x3f)==0) WaitCursor();
+ for (j=bitnum=0; j<padw; j++,bitnum++) {
+@@ -377,8 +376,8 @@
+ u_int w,h,comp;
+ {
+ int i,j,c,c1,x,y,nybnum,padw,rv;
+- byte *pp;
+-
++ byte *pp = pic8 + ((h - 1) * w);
++ size_t l = w*h;
+
+ rv = 0;
+ c = c1 = 0;
+@@ -386,7 +385,7 @@
+ if (comp == BI_RGB) { /* read uncompressed data */
+ padw = ((w + 7)/8) * 8; /* 'w' padded to a multiple of 8pix (32 bits) */
+
+- for (i=h-1; i>=0; i--) {
++ for (i=h-1; i>=0 && (pp - pic8 <= l); i--) {
+ pp = pic8 + (i * w);
+ if ((i&0x3f)==0) WaitCursor();
+
+@@ -414,7 +413,7 @@
+
+ if (c) { /* encoded mode */
+ c1 = getc(fp);
+- for (i=0; i<c; i++,x++,pp++)
++ for (i=0; i<c && (pp - pic8 <= l); i++,x++,pp++)
+ *pp = (i&1) ? (c1 & 0x0f) : ((c1>>4)&0x0f);
+ }
+
+@@ -434,7 +433,7 @@
+ }
+
+ else { /* absolute mode */
+- for (i=0; i<c; i++, x++, pp++) {
++ for (i=0; i<c && (pp - pic8 <= l); i++, x++, pp++) {
+ if ((i&1) == 0) c1 = getc(fp);
+ *pp = (i&1) ? (c1 & 0x0f) : ((c1>>4)&0x0f);
+ }
+@@ -463,7 +462,9 @@
+ u_int w,h,comp;
+ {
+ int i,j,c,c1,padw,x,y,rv;
+- byte *pp, *pend;
++ byte *pp = pic8 + ((h - 1) * w);
++ size_t l = w*h;
++ byte *pend;
+
+ rv = 0;
+
+@@ -472,7 +473,7 @@
+ if (comp == BI_RGB) { /* read uncompressed data */
+ padw = ((w + 3)/4) * 4; /* 'w' padded to a multiple of 4pix (32 bits) */
+
+- for (i=h-1; i>=0; i--) {
++ for (i=h-1; i>=0 && (pp - pic8 <= l); i--) {
+ pp = pic8 + (i * w);
+ if ((i&0x3f)==0) WaitCursor();
+
+@@ -541,7 +542,8 @@
+ u_int w, h, *mask;
+ {
+ int x, y;
+- byte *pp;
++ byte *pp = pic24 + ((h - 1) * w * 3);
++ size_t l = w*h*3;
+ u_int buf, colormask[6];
+ int i, bit, bitshift[6], colorbits[6], bitshift2[6];
+
+@@ -611,7 +613,7 @@
+ colorbits[2], colormask[2], bitshift[2], bitshift2[2],
+ colormask[5], bitshift[5], bitshift2[5]);
+
+- for (y = h-1; y >= 0; y--) {
++ for (y = h-1; y >= 0 && (pp - pic24 <= l); y--) {
+ pp = pic24 + (3 * w * y);
+ if ((y&0x3f)==0) WaitCursor();
+
+@@ -644,7 +646,8 @@
+ u_int w,h, bits;
+ {
+ int i,j,padb,rv;
+- byte *pp;
++ byte *pp = pic24 + ((h - 1) * w * 3);
++ size_t l = w*h*3;
+
+ rv = 0;
+
+@@ -655,7 +658,7 @@
+ pp = pic24 + (i * w * 3);
+ if ((i&0x3f)==0) WaitCursor();
+
+- for (j=0; j<w; j++) {
++ for (j=0; j<w && (pp - pic24 <= l); j++) {
+ pp[2] = getc(fp); /* blue */
+ pp[1] = getc(fp); /* green */
+ pp[0] = getc(fp); /* red */