Blame SOURCES/jasper-CVE-2014-8158.patch

60b290
diff -up jasper-1.900.1/src/libjasper/jpc/jpc_qmfb.c.CVE-2014-8158 jasper-1.900.1/src/libjasper/jpc/jpc_qmfb.c
60b290
--- jasper-1.900.1/src/libjasper/jpc/jpc_qmfb.c.CVE-2014-8158	2015-01-19 17:25:28.730195502 +0100
60b290
+++ jasper-1.900.1/src/libjasper/jpc/jpc_qmfb.c	2015-01-19 17:27:20.214663127 +0100
60b290
@@ -306,11 +306,7 @@ void jpc_qmfb_split_row(jpc_fix_t *a, in
60b290
 {
60b290
 
60b290
 	int bufsize = JPC_CEILDIVPOW2(numcols, 1);
60b290
-#if !defined(HAVE_VLA)
60b290
 	jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE];
60b290
-#else
60b290
-	jpc_fix_t splitbuf[bufsize];
60b290
-#endif
60b290
 	jpc_fix_t *buf = splitbuf;
60b290
 	register jpc_fix_t *srcptr;
60b290
 	register jpc_fix_t *dstptr;
60b290
@@ -318,7 +314,6 @@ void jpc_qmfb_split_row(jpc_fix_t *a, in
60b290
 	register int m;
60b290
 	int hstartcol;
60b290
 
60b290
-#if !defined(HAVE_VLA)
60b290
 	/* Get a buffer. */
60b290
 	if (bufsize > QMFB_SPLITBUFSIZE) {
60b290
 		if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) {
60b290
@@ -326,7 +321,6 @@ void jpc_qmfb_split_row(jpc_fix_t *a, in
60b290
 			abort();
60b290
 		}
60b290
 	}
60b290
-#endif
60b290
 
60b290
 	if (numcols >= 2) {
60b290
 		hstartcol = (numcols + 1 - parity) >> 1;
60b290
@@ -360,12 +354,10 @@ void jpc_qmfb_split_row(jpc_fix_t *a, in
60b290
 		}
60b290
 	}
60b290
 
60b290
-#if !defined(HAVE_VLA)
60b290
 	/* If the split buffer was allocated on the heap, free this memory. */
60b290
 	if (buf != splitbuf) {
60b290
 		jas_free(buf);
60b290
 	}
60b290
-#endif
60b290
 
60b290
 }
60b290
 
60b290
@@ -374,11 +366,7 @@ void jpc_qmfb_split_col(jpc_fix_t *a, in
60b290
 {
60b290
 
60b290
 	int bufsize = JPC_CEILDIVPOW2(numrows, 1);
60b290
-#if !defined(HAVE_VLA)
60b290
 	jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE];
60b290
-#else
60b290
-	jpc_fix_t splitbuf[bufsize];
60b290
-#endif
60b290
 	jpc_fix_t *buf = splitbuf;
60b290
 	register jpc_fix_t *srcptr;
60b290
 	register jpc_fix_t *dstptr;
60b290
@@ -386,7 +374,6 @@ void jpc_qmfb_split_col(jpc_fix_t *a, in
60b290
 	register int m;
60b290
 	int hstartcol;
60b290
 
60b290
-#if !defined(HAVE_VLA)
60b290
 	/* Get a buffer. */
60b290
 	if (bufsize > QMFB_SPLITBUFSIZE) {
60b290
 		if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) {
60b290
@@ -394,7 +381,6 @@ void jpc_qmfb_split_col(jpc_fix_t *a, in
60b290
 			abort();
60b290
 		}
60b290
 	}
60b290
-#endif
60b290
 
60b290
 	if (numrows >= 2) {
60b290
 		hstartcol = (numrows + 1 - parity) >> 1;
60b290
@@ -428,12 +414,10 @@ void jpc_qmfb_split_col(jpc_fix_t *a, in
60b290
 		}
60b290
 	}
60b290
 
60b290
-#if !defined(HAVE_VLA)
60b290
 	/* If the split buffer was allocated on the heap, free this memory. */
60b290
 	if (buf != splitbuf) {
60b290
 		jas_free(buf);
60b290
 	}
60b290
-#endif
60b290
 
60b290
 }
60b290
 
60b290
@@ -442,11 +426,7 @@ void jpc_qmfb_split_colgrp(jpc_fix_t *a,
60b290
 {
60b290
 
60b290
 	int bufsize = JPC_CEILDIVPOW2(numrows, 1);
60b290
-#if !defined(HAVE_VLA)
60b290
 	jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE * JPC_QMFB_COLGRPSIZE];
60b290
-#else
60b290
-	jpc_fix_t splitbuf[bufsize * JPC_QMFB_COLGRPSIZE];
60b290
-#endif
60b290
 	jpc_fix_t *buf = splitbuf;
60b290
 	jpc_fix_t *srcptr;
60b290
 	jpc_fix_t *dstptr;
60b290
@@ -457,7 +437,6 @@ void jpc_qmfb_split_colgrp(jpc_fix_t *a,
60b290
 	int m;
60b290
 	int hstartcol;
60b290
 
60b290
-#if !defined(HAVE_VLA)
60b290
 	/* Get a buffer. */
60b290
 	if (bufsize > QMFB_SPLITBUFSIZE) {
60b290
 		if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) {
60b290
@@ -465,7 +444,6 @@ void jpc_qmfb_split_colgrp(jpc_fix_t *a,
60b290
 			abort();
60b290
 		}
60b290
 	}
60b290
-#endif
60b290
 
60b290
 	if (numrows >= 2) {
60b290
 		hstartcol = (numrows + 1 - parity) >> 1;
60b290
@@ -517,12 +495,10 @@ void jpc_qmfb_split_colgrp(jpc_fix_t *a,
60b290
 		}
60b290
 	}
60b290
 
60b290
-#if !defined(HAVE_VLA)
60b290
 	/* If the split buffer was allocated on the heap, free this memory. */
60b290
 	if (buf != splitbuf) {
60b290
 		jas_free(buf);
60b290
 	}
60b290
-#endif
60b290
 
60b290
 }
60b290
 
60b290
@@ -531,11 +507,7 @@ void jpc_qmfb_split_colres(jpc_fix_t *a,
60b290
 {
60b290
 
60b290
 	int bufsize = JPC_CEILDIVPOW2(numrows, 1);
60b290
-#if !defined(HAVE_VLA)
60b290
 	jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE * JPC_QMFB_COLGRPSIZE];
60b290
-#else
60b290
-	jpc_fix_t splitbuf[bufsize * numcols];
60b290
-#endif
60b290
 	jpc_fix_t *buf = splitbuf;
60b290
 	jpc_fix_t *srcptr;
60b290
 	jpc_fix_t *dstptr;
60b290
@@ -546,7 +518,6 @@ void jpc_qmfb_split_colres(jpc_fix_t *a,
60b290
 	int m;
60b290
 	int hstartcol;
60b290
 
60b290
-#if !defined(HAVE_VLA)
60b290
 	/* Get a buffer. */
60b290
 	if (bufsize > QMFB_SPLITBUFSIZE) {
60b290
 		if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) {
60b290
@@ -554,7 +525,6 @@ void jpc_qmfb_split_colres(jpc_fix_t *a,
60b290
 			abort();
60b290
 		}
60b290
 	}
60b290
-#endif
60b290
 
60b290
 	if (numrows >= 2) {
60b290
 		hstartcol = (numrows + 1 - parity) >> 1;
60b290
@@ -606,12 +576,10 @@ void jpc_qmfb_split_colres(jpc_fix_t *a,
60b290
 		}
60b290
 	}
60b290
 
60b290
-#if !defined(HAVE_VLA)
60b290
 	/* If the split buffer was allocated on the heap, free this memory. */
60b290
 	if (buf != splitbuf) {
60b290
 		jas_free(buf);
60b290
 	}
60b290
-#endif
60b290
 
60b290
 }
60b290
 
60b290
@@ -619,18 +587,13 @@ void jpc_qmfb_join_row(jpc_fix_t *a, int
60b290
 {
60b290
 
60b290
 	int bufsize = JPC_CEILDIVPOW2(numcols, 1);
60b290
-#if !defined(HAVE_VLA)
60b290
 	jpc_fix_t joinbuf[QMFB_JOINBUFSIZE];
60b290
-#else
60b290
-	jpc_fix_t joinbuf[bufsize];
60b290
-#endif
60b290
 	jpc_fix_t *buf = joinbuf;
60b290
 	register jpc_fix_t *srcptr;
60b290
 	register jpc_fix_t *dstptr;
60b290
 	register int n;
60b290
 	int hstartcol;
60b290
 
60b290
-#if !defined(HAVE_VLA)
60b290
 	/* Allocate memory for the join buffer from the heap. */
60b290
 	if (bufsize > QMFB_JOINBUFSIZE) {
60b290
 		if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) {
60b290
@@ -638,7 +601,6 @@ void jpc_qmfb_join_row(jpc_fix_t *a, int
60b290
 			abort();
60b290
 		}
60b290
 	}
60b290
-#endif
60b290
 
60b290
 	hstartcol = (numcols + 1 - parity) >> 1;
60b290
 
60b290
@@ -670,12 +632,10 @@ void jpc_qmfb_join_row(jpc_fix_t *a, int
60b290
 		++srcptr;
60b290
 	}
60b290
 
60b290
-#if !defined(HAVE_VLA)
60b290
 	/* If the join buffer was allocated on the heap, free this memory. */
60b290
 	if (buf != joinbuf) {
60b290
 		jas_free(buf);
60b290
 	}
60b290
-#endif
60b290
 
60b290
 }
60b290
 
60b290
@@ -684,18 +644,13 @@ void jpc_qmfb_join_col(jpc_fix_t *a, int
60b290
 {
60b290
 
60b290
 	int bufsize = JPC_CEILDIVPOW2(numrows, 1);
60b290
-#if !defined(HAVE_VLA)
60b290
 	jpc_fix_t joinbuf[QMFB_JOINBUFSIZE];
60b290
-#else
60b290
-	jpc_fix_t joinbuf[bufsize];
60b290
-#endif
60b290
 	jpc_fix_t *buf = joinbuf;
60b290
 	register jpc_fix_t *srcptr;
60b290
 	register jpc_fix_t *dstptr;
60b290
 	register int n;
60b290
 	int hstartcol;
60b290
 
60b290
-#if !defined(HAVE_VLA)
60b290
 	/* Allocate memory for the join buffer from the heap. */
60b290
 	if (bufsize > QMFB_JOINBUFSIZE) {
60b290
 		if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) {
60b290
@@ -703,7 +658,6 @@ void jpc_qmfb_join_col(jpc_fix_t *a, int
60b290
 			abort();
60b290
 		}
60b290
 	}
60b290
-#endif
60b290
 
60b290
 	hstartcol = (numrows + 1 - parity) >> 1;
60b290
 
60b290
@@ -735,12 +689,10 @@ void jpc_qmfb_join_col(jpc_fix_t *a, int
60b290
 		++srcptr;
60b290
 	}
60b290
 
60b290
-#if !defined(HAVE_VLA)
60b290
 	/* If the join buffer was allocated on the heap, free this memory. */
60b290
 	if (buf != joinbuf) {
60b290
 		jas_free(buf);
60b290
 	}
60b290
-#endif
60b290
 
60b290
 }
60b290
 
60b290
@@ -749,11 +701,7 @@ void jpc_qmfb_join_colgrp(jpc_fix_t *a,
60b290
 {
60b290
 
60b290
 	int bufsize = JPC_CEILDIVPOW2(numrows, 1);
60b290
-#if !defined(HAVE_VLA)
60b290
 	jpc_fix_t joinbuf[QMFB_JOINBUFSIZE * JPC_QMFB_COLGRPSIZE];
60b290
-#else
60b290
-	jpc_fix_t joinbuf[bufsize * JPC_QMFB_COLGRPSIZE];
60b290
-#endif
60b290
 	jpc_fix_t *buf = joinbuf;
60b290
 	jpc_fix_t *srcptr;
60b290
 	jpc_fix_t *dstptr;
60b290
@@ -763,7 +711,6 @@ void jpc_qmfb_join_colgrp(jpc_fix_t *a,
60b290
 	register int i;
60b290
 	int hstartcol;
60b290
 
60b290
-#if !defined(HAVE_VLA)
60b290
 	/* Allocate memory for the join buffer from the heap. */
60b290
 	if (bufsize > QMFB_JOINBUFSIZE) {
60b290
 		if (!(buf = jas_alloc2(bufsize, JPC_QMFB_COLGRPSIZE * sizeof(jpc_fix_t)))) {
60b290
@@ -771,7 +718,6 @@ void jpc_qmfb_join_colgrp(jpc_fix_t *a,
60b290
 			abort();
60b290
 		}
60b290
 	}
60b290
-#endif
60b290
 
60b290
 	hstartcol = (numrows + 1 - parity) >> 1;
60b290
 
60b290
@@ -821,12 +767,10 @@ void jpc_qmfb_join_colgrp(jpc_fix_t *a,
60b290
 		srcptr += JPC_QMFB_COLGRPSIZE;
60b290
 	}
60b290
 
60b290
-#if !defined(HAVE_VLA)
60b290
 	/* If the join buffer was allocated on the heap, free this memory. */
60b290
 	if (buf != joinbuf) {
60b290
 		jas_free(buf);
60b290
 	}
60b290
-#endif
60b290
 
60b290
 }
60b290
 
60b290
@@ -835,11 +779,7 @@ void jpc_qmfb_join_colres(jpc_fix_t *a,
60b290
 {
60b290
 
60b290
 	int bufsize = JPC_CEILDIVPOW2(numrows, 1);
60b290
-#if !defined(HAVE_VLA)
60b290
 	jpc_fix_t joinbuf[QMFB_JOINBUFSIZE * JPC_QMFB_COLGRPSIZE];
60b290
-#else
60b290
-	jpc_fix_t joinbuf[bufsize * numcols];
60b290
-#endif
60b290
 	jpc_fix_t *buf = joinbuf;
60b290
 	jpc_fix_t *srcptr;
60b290
 	jpc_fix_t *dstptr;
60b290
@@ -849,7 +789,6 @@ void jpc_qmfb_join_colres(jpc_fix_t *a,
60b290
 	register int i;
60b290
 	int hstartcol;
60b290
 
60b290
-#if !defined(HAVE_VLA)
60b290
 	/* Allocate memory for the join buffer from the heap. */
60b290
 	if (bufsize > QMFB_JOINBUFSIZE) {
60b290
 		if (!(buf = jas_alloc3(bufsize, numcols, sizeof(jpc_fix_t)))) {
60b290
@@ -857,7 +796,6 @@ void jpc_qmfb_join_colres(jpc_fix_t *a,
60b290
 			abort();
60b290
 		}
60b290
 	}
60b290
-#endif
60b290
 
60b290
 	hstartcol = (numrows + 1 - parity) >> 1;
60b290
 
60b290
@@ -907,12 +845,10 @@ void jpc_qmfb_join_colres(jpc_fix_t *a,
60b290
 		srcptr += numcols;
60b290
 	}
60b290
 
60b290
-#if !defined(HAVE_VLA)
60b290
 	/* If the join buffer was allocated on the heap, free this memory. */
60b290
 	if (buf != joinbuf) {
60b290
 		jas_free(buf);
60b290
 	}
60b290
-#endif
60b290
 
60b290
 }
60b290