Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 222819 | Differences between
and this patch

Collapse All | Expand All

(-)jasper-1.900.1/src/libjasper/base/jas_icc.c (-2 / +2 lines)
Lines 1461-1468 static int jas_icclut16_input(jas_iccatt Link Here
1461
		goto error;
1461
		goto error;
1462
	clutsize = jas_iccpowi(lut16->clutlen, lut16->numinchans) * lut16->numoutchans;
1462
	clutsize = jas_iccpowi(lut16->clutlen, lut16->numinchans) * lut16->numoutchans;
1463
	if (!(lut16->clut = jas_alloc2(clutsize, sizeof(jas_iccuint16_t))) ||
1463
	if (!(lut16->clut = jas_alloc2(clutsize, sizeof(jas_iccuint16_t))) ||
1464
	  !(lut16->intabsbuf = jas_malloc(lut16->numinchans *
1464
	  !(lut16->intabsbuf = jas_alloc3(lut16->numinchans,
1465
	  lut16->numintabents * sizeof(jas_iccuint16_t))) ||
1465
	  lut16->numintabents, sizeof(jas_iccuint16_t))) ||
1466
	  !(lut16->intabs = jas_alloc2(lut16->numinchans,
1466
	  !(lut16->intabs = jas_alloc2(lut16->numinchans,
1467
	  sizeof(jas_iccuint16_t *))))
1467
	  sizeof(jas_iccuint16_t *))))
1468
		goto error;
1468
		goto error;
(-)jasper-1.900.1/src/libjasper/jp2/jp2_cod.c (-6 / +6 lines)
Lines 372-378 static int jp2_bpcc_getdata(jp2_box_t *b Link Here
372
	jp2_bpcc_t *bpcc = &box->data.bpcc;
372
	jp2_bpcc_t *bpcc = &box->data.bpcc;
373
	unsigned int i;
373
	unsigned int i;
374
	bpcc->numcmpts = box->datalen;
374
	bpcc->numcmpts = box->datalen;
375
	if (!(bpcc->bpcs = jas_malloc(bpcc->numcmpts * sizeof(uint_fast8_t)))) {
375
	if (!(bpcc->bpcs = jas_alloc2(bpcc->numcmpts, sizeof(uint_fast8_t)))) {
376
		return -1;
376
		return -1;
377
	}
377
	}
378
	for (i = 0; i < bpcc->numcmpts; ++i) {
378
	for (i = 0; i < bpcc->numcmpts; ++i) {
Lines 416-422 static int jp2_colr_getdata(jp2_box_t *b Link Here
416
		break;
416
		break;
417
	case JP2_COLR_ICC:
417
	case JP2_COLR_ICC:
418
		colr->iccplen = box->datalen - 3;
418
		colr->iccplen = box->datalen - 3;
419
		if (!(colr->iccp = jas_malloc(colr->iccplen * sizeof(uint_fast8_t)))) {
419
		if (!(colr->iccp = jas_alloc2(colr->iccplen, sizeof(uint_fast8_t)))) {
420
			return -1;
420
			return -1;
421
		}
421
		}
422
		if (jas_stream_read(in, colr->iccp, colr->iccplen) != colr->iccplen) {
422
		if (jas_stream_read(in, colr->iccp, colr->iccplen) != colr->iccplen) {
Lines 453-459 static int jp2_cdef_getdata(jp2_box_t *b Link Here
453
	if (jp2_getuint16(in, &cdef->numchans)) {
453
	if (jp2_getuint16(in, &cdef->numchans)) {
454
		return -1;
454
		return -1;
455
	}
455
	}
456
	if (!(cdef->ents = jas_malloc(cdef->numchans * sizeof(jp2_cdefchan_t)))) {
456
	if (!(cdef->ents = jas_alloc2(cdef->numchans, sizeof(jp2_cdefchan_t)))) {
457
		return -1;
457
		return -1;
458
	}
458
	}
459
	for (channo = 0; channo < cdef->numchans; ++channo) {
459
	for (channo = 0; channo < cdef->numchans; ++channo) {
Lines 766-772 static int jp2_cmap_getdata(jp2_box_t *b Link Here
766
	unsigned int i;
766
	unsigned int i;
767
767
768
	cmap->numchans = (box->datalen) / 4;
768
	cmap->numchans = (box->datalen) / 4;
769
	if (!(cmap->ents = jas_malloc(cmap->numchans * sizeof(jp2_cmapent_t)))) {
769
	if (!(cmap->ents = jas_alloc2(cmap->numchans, sizeof(jp2_cmapent_t)))) {
770
		return -1;
770
		return -1;
771
	}
771
	}
772
	for (i = 0; i < cmap->numchans; ++i) {
772
	for (i = 0; i < cmap->numchans; ++i) {
Lines 832-841 static int jp2_pclr_getdata(jp2_box_t *b Link Here
832
		return -1;
832
		return -1;
833
	}
833
	}
834
	lutsize = pclr->numlutents * pclr->numchans;
834
	lutsize = pclr->numlutents * pclr->numchans;
835
	if (!(pclr->lutdata = jas_malloc(lutsize * sizeof(int_fast32_t)))) {
835
	if (!(pclr->lutdata = jas_alloc2(lutsize, sizeof(int_fast32_t)))) {
836
		return -1;
836
		return -1;
837
	}
837
	}
838
	if (!(pclr->bpc = jas_malloc(pclr->numchans * sizeof(uint_fast8_t)))) {
838
	if (!(pclr->bpc = jas_alloc2(pclr->numchans, sizeof(uint_fast8_t)))) {
839
		return -1;
839
		return -1;
840
	}
840
	}
841
	for (i = 0; i < pclr->numchans; ++i) {
841
	for (i = 0; i < pclr->numchans; ++i) {
(-)jasper-1.900.1/src/libjasper/jp2/jp2_dec.c (-2 / +2 lines)
Lines 338-344 jas_image_t *jp2_decode(jas_stream_t *in Link Here
338
	}
338
	}
339
339
340
	/* Allocate space for the channel-number to component-number LUT. */
340
	/* Allocate space for the channel-number to component-number LUT. */
341
	if (!(dec->chantocmptlut = jas_malloc(dec->numchans * sizeof(uint_fast16_t)))) {
341
	if (!(dec->chantocmptlut = jas_alloc2(dec->numchans, sizeof(uint_fast16_t)))) {
342
		jas_eprintf("error: no memory\n");
342
		jas_eprintf("error: no memory\n");
343
		goto error;
343
		goto error;
344
	}
344
	}
Lines 356-362 jas_image_t *jp2_decode(jas_stream_t *in Link Here
356
			if (cmapent->map == JP2_CMAP_DIRECT) {
356
			if (cmapent->map == JP2_CMAP_DIRECT) {
357
				dec->chantocmptlut[channo] = channo;
357
				dec->chantocmptlut[channo] = channo;
358
			} else if (cmapent->map == JP2_CMAP_PALETTE) {
358
			} else if (cmapent->map == JP2_CMAP_PALETTE) {
359
				lutents = jas_malloc(pclrd->numlutents * sizeof(int_fast32_t));
359
				lutents = jas_alloc2(pclrd->numlutents, sizeof(int_fast32_t));
360
				for (i = 0; i < pclrd->numlutents; ++i) {
360
				for (i = 0; i < pclrd->numlutents; ++i) {
361
					lutents[i] = pclrd->lutdata[cmapent->pcol + i * pclrd->numchans];
361
					lutents[i] = pclrd->lutdata[cmapent->pcol + i * pclrd->numchans];
362
				}
362
				}
(-)jasper-1.900.1/src/libjasper/jpc/jpc_dec.c (-14 / +13 lines)
Lines 449-455 static int jpc_dec_process_sot(jpc_dec_t Link Here
449
449
450
	if (dec->state == JPC_MH) {
450
	if (dec->state == JPC_MH) {
451
451
452
		compinfos = jas_malloc(dec->numcomps * sizeof(jas_image_cmptparm_t));
452
		compinfos = jas_alloc2(dec->numcomps, sizeof(jas_image_cmptparm_t));
453
		assert(compinfos);
453
		assert(compinfos);
454
		for (cmptno = 0, cmpt = dec->cmpts, compinfo = compinfos;
454
		for (cmptno = 0, cmpt = dec->cmpts, compinfo = compinfos;
455
		  cmptno < dec->numcomps; ++cmptno, ++cmpt, ++compinfo) {
455
		  cmptno < dec->numcomps; ++cmptno, ++cmpt, ++compinfo) {
Lines 692-698 static int jpc_dec_tileinit(jpc_dec_t *d Link Here
692
			tile->realmode = 1;
692
			tile->realmode = 1;
693
		}
693
		}
694
		tcomp->numrlvls = ccp->numrlvls;
694
		tcomp->numrlvls = ccp->numrlvls;
695
		if (!(tcomp->rlvls = jas_malloc(tcomp->numrlvls *
695
		if (!(tcomp->rlvls = jas_alloc2(tcomp->numrlvls,
696
		  sizeof(jpc_dec_rlvl_t)))) {
696
		  sizeof(jpc_dec_rlvl_t)))) {
697
			return -1;
697
			return -1;
698
		}
698
		}
Lines 764-770 rlvl->bands = 0; Link Here
764
			  rlvl->cbgheightexpn);
764
			  rlvl->cbgheightexpn);
765
765
766
			rlvl->numbands = (!rlvlno) ? 1 : 3;
766
			rlvl->numbands = (!rlvlno) ? 1 : 3;
767
			if (!(rlvl->bands = jas_malloc(rlvl->numbands *
767
			if (!(rlvl->bands = jas_alloc2(rlvl->numbands,
768
			  sizeof(jpc_dec_band_t)))) {
768
			  sizeof(jpc_dec_band_t)))) {
769
				return -1;
769
				return -1;
770
			}
770
			}
Lines 797-803 rlvl->bands = 0; Link Here
797
797
798
				assert(rlvl->numprcs);
798
				assert(rlvl->numprcs);
799
799
800
				if (!(band->prcs = jas_malloc(rlvl->numprcs * sizeof(jpc_dec_prc_t)))) {
800
				if (!(band->prcs = jas_alloc2(rlvl->numprcs, sizeof(jpc_dec_prc_t)))) {
801
					return -1;
801
					return -1;
802
				}
802
				}
803
803
Lines 834-840 rlvl->bands = 0; Link Here
834
			if (!(prc->numimsbstagtree = jpc_tagtree_create(prc->numhcblks, prc->numvcblks))) {
834
			if (!(prc->numimsbstagtree = jpc_tagtree_create(prc->numhcblks, prc->numvcblks))) {
835
				return -1;
835
				return -1;
836
			}
836
			}
837
			if (!(prc->cblks = jas_malloc(prc->numcblks * sizeof(jpc_dec_cblk_t)))) {
837
			if (!(prc->cblks = jas_alloc2(prc->numcblks, sizeof(jpc_dec_cblk_t)))) {
838
				return -1;
838
				return -1;
839
			}
839
			}
840
840
Lines 1181-1187 static int jpc_dec_process_siz(jpc_dec_t Link Here
1181
		return -1;
1181
		return -1;
1182
	}
1182
	}
1183
1183
1184
	if (!(dec->cmpts = jas_malloc(dec->numcomps * sizeof(jpc_dec_cmpt_t)))) {
1184
	if (!(dec->cmpts = jas_alloc2(dec->numcomps, sizeof(jpc_dec_cmpt_t)))) {
1185
		return -1;
1185
		return -1;
1186
	}
1186
	}
1187
1187
Lines 1204-1210 static int jpc_dec_process_siz(jpc_dec_t Link Here
1204
	dec->numhtiles = JPC_CEILDIV(dec->xend - dec->tilexoff, dec->tilewidth);
1204
	dec->numhtiles = JPC_CEILDIV(dec->xend - dec->tilexoff, dec->tilewidth);
1205
	dec->numvtiles = JPC_CEILDIV(dec->yend - dec->tileyoff, dec->tileheight);
1205
	dec->numvtiles = JPC_CEILDIV(dec->yend - dec->tileyoff, dec->tileheight);
1206
	dec->numtiles = dec->numhtiles * dec->numvtiles;
1206
	dec->numtiles = dec->numhtiles * dec->numvtiles;
1207
	if (!(dec->tiles = jas_malloc(dec->numtiles * sizeof(jpc_dec_tile_t)))) {
1207
	if (!(dec->tiles = jas_alloc2(dec->numtiles, sizeof(jpc_dec_tile_t)))) {
1208
		return -1;
1208
		return -1;
1209
	}
1209
	}
1210
1210
Lines 1228-1234 static int jpc_dec_process_siz(jpc_dec_t Link Here
1228
		tile->pkthdrstreampos = 0;
1228
		tile->pkthdrstreampos = 0;
1229
		tile->pptstab = 0;
1229
		tile->pptstab = 0;
1230
		tile->cp = 0;
1230
		tile->cp = 0;
1231
		if (!(tile->tcomps = jas_malloc(dec->numcomps *
1231
		if (!(tile->tcomps = jas_alloc2(dec->numcomps,
1232
		  sizeof(jpc_dec_tcomp_t)))) {
1232
		  sizeof(jpc_dec_tcomp_t)))) {
1233
			return -1;
1233
			return -1;
1234
		}
1234
		}
Lines 1491-1497 static jpc_dec_cp_t *jpc_dec_cp_create(u Link Here
1491
	cp->numlyrs = 0;
1491
	cp->numlyrs = 0;
1492
	cp->mctid = 0;
1492
	cp->mctid = 0;
1493
	cp->csty = 0;
1493
	cp->csty = 0;
1494
	if (!(cp->ccps = jas_malloc(cp->numcomps * sizeof(jpc_dec_ccp_t)))) {
1494
	if (!(cp->ccps = jas_alloc2(cp->numcomps, sizeof(jpc_dec_ccp_t)))) {
1495
		return 0;
1495
		return 0;
1496
	}
1496
	}
1497
	if (!(cp->pchglist = jpc_pchglist_create())) {
1497
	if (!(cp->pchglist = jpc_pchglist_create())) {
Lines 2050-2056 jpc_streamlist_t *jpc_streamlist_create( Link Here
2050
	}
2050
	}
2051
	streamlist->numstreams = 0;
2051
	streamlist->numstreams = 0;
2052
	streamlist->maxstreams = 100;
2052
	streamlist->maxstreams = 100;
2053
	if (!(streamlist->streams = jas_malloc(streamlist->maxstreams *
2053
	if (!(streamlist->streams = jas_alloc2(streamlist->maxstreams,
2054
	  sizeof(jas_stream_t *)))) {
2054
	  sizeof(jas_stream_t *)))) {
2055
		jas_free(streamlist);
2055
		jas_free(streamlist);
2056
		return 0;
2056
		return 0;
Lines 2070-2077 int jpc_streamlist_insert(jpc_streamlist Link Here
2070
	/* Grow the array of streams if necessary. */
2070
	/* Grow the array of streams if necessary. */
2071
	if (streamlist->numstreams >= streamlist->maxstreams) {
2071
	if (streamlist->numstreams >= streamlist->maxstreams) {
2072
		newmaxstreams = streamlist->maxstreams + 1024;
2072
		newmaxstreams = streamlist->maxstreams + 1024;
2073
		if (!(newstreams = jas_realloc(streamlist->streams,
2073
		if (!(newstreams = jas_realloc2(streamlist->streams,
2074
		  (newmaxstreams + 1024) * sizeof(jas_stream_t *)))) {
2074
		  (newmaxstreams + 1024), sizeof(jas_stream_t *)))) {
2075
			return -1;
2075
			return -1;
2076
		}
2076
		}
2077
		for (i = streamlist->numstreams; i < streamlist->maxstreams; ++i) {
2077
		for (i = streamlist->numstreams; i < streamlist->maxstreams; ++i) {
Lines 2157-2164 int jpc_ppxstab_grow(jpc_ppxstab_t *tab, Link Here
2157
{
2157
{
2158
	jpc_ppxstabent_t **newents;
2158
	jpc_ppxstabent_t **newents;
2159
	if (tab->maxents < maxents) {
2159
	if (tab->maxents < maxents) {
2160
		newents = (tab->ents) ? jas_realloc(tab->ents, maxents *
2160
		newents = jas_realloc2(tab->ents, maxents, sizeof(jpc_ppxstabent_t *));
2161
		  sizeof(jpc_ppxstabent_t *)) : jas_malloc(maxents * sizeof(jpc_ppxstabent_t *));
2162
		if (!newents) {
2161
		if (!newents) {
2163
			return -1;
2162
			return -1;
2164
		}
2163
		}

Return to bug 222819