Blame SOURCES/jasper-1.900.1-CVE-2011-4516-CVE-2011-4517-CERT-VU-887409.patch

83be9e
diff -up jasper-1.900.1/src/libjasper/jpc/jpc_cs.c.CERT-VU-887409 jasper-1.900.1/src/libjasper/jpc/jpc_cs.c
83be9e
--- jasper-1.900.1/src/libjasper/jpc/jpc_cs.c.CERT-VU-887409	2011-10-25 17:25:39.000000000 +0200
83be9e
+++ jasper-1.900.1/src/libjasper/jpc/jpc_cs.c	2011-10-25 17:29:14.379371908 +0200
83be9e
@@ -744,6 +744,10 @@ static int jpc_cox_getcompparms(jpc_ms_t
83be9e
 		return -1;
83be9e
 	}
83be9e
 	compparms->numrlvls = compparms->numdlvls + 1;
83be9e
+	if (compparms->numrlvls > JPC_MAXRLVLS) {
83be9e
+		jpc_cox_destroycompparms(compparms);
83be9e
+		return -1;
83be9e
+	}
83be9e
 	if (prtflag) {
83be9e
 		for (i = 0; i < compparms->numrlvls; ++i) {
83be9e
 			if (jpc_getuint8(in, &tmp)) {
83be9e
@@ -1331,7 +1335,7 @@ static int jpc_crg_getparms(jpc_ms_t *ms
83be9e
 	jpc_crgcomp_t *comp;
83be9e
 	uint_fast16_t compno;
83be9e
 	crg->numcomps = cstate->numcomps;
83be9e
-	if (!(crg->comps = jas_alloc2(cstate->numcomps, sizeof(uint_fast16_t)))) {
83be9e
+	if (!(crg->comps = jas_alloc2(cstate->numcomps, sizeof(jpc_crgcomp_t)))) {
83be9e
 		return -1;
83be9e
 	}
83be9e
 	for (compno = 0, comp = crg->comps; compno < cstate->numcomps;