Added
Link Here
|
1 |
--- ./src/libjasper/base/jas_icc.c.orig 2007-01-19 21:43:05.000000000 +0000 |
2 |
+++ ./src/libjasper/base/jas_icc.c 2011-12-30 03:00:54.000000000 +0000 |
3 |
@@ -373,7 +373,7 @@ |
4 |
jas_icctagtab_t *tagtab; |
5 |
|
6 |
tagtab = &prof->tagtab; |
7 |
- if (!(tagtab->ents = jas_malloc(prof->attrtab->numattrs * |
8 |
+ if (!(tagtab->ents = jas_alloc2(prof->attrtab->numattrs, |
9 |
sizeof(jas_icctagtabent_t)))) |
10 |
goto error; |
11 |
tagtab->numents = prof->attrtab->numattrs; |
12 |
@@ -522,7 +522,7 @@ |
13 |
} |
14 |
if (jas_iccgetuint32(in, &tagtab->numents)) |
15 |
goto error; |
16 |
- if (!(tagtab->ents = jas_malloc(tagtab->numents * |
17 |
+ if (!(tagtab->ents = jas_alloc2(tagtab->numents, |
18 |
sizeof(jas_icctagtabent_t)))) |
19 |
goto error; |
20 |
tagtabent = tagtab->ents; |
21 |
@@ -743,8 +743,7 @@ |
22 |
{ |
23 |
jas_iccattr_t *newattrs; |
24 |
assert(maxents >= tab->numattrs); |
25 |
- newattrs = tab->attrs ? jas_realloc(tab->attrs, maxents * |
26 |
- sizeof(jas_iccattr_t)) : jas_malloc(maxents * sizeof(jas_iccattr_t)); |
27 |
+ newattrs = jas_realloc2(tab->attrs, maxents, sizeof(jas_iccattr_t)); |
28 |
if (!newattrs) |
29 |
return -1; |
30 |
tab->attrs = newattrs; |
31 |
@@ -999,7 +998,7 @@ |
32 |
|
33 |
if (jas_iccgetuint32(in, &curv->numents)) |
34 |
goto error; |
35 |
- if (!(curv->ents = jas_malloc(curv->numents * sizeof(jas_iccuint16_t)))) |
36 |
+ if (!(curv->ents = jas_alloc2(curv->numents, sizeof(jas_iccuint16_t)))) |
37 |
goto error; |
38 |
for (i = 0; i < curv->numents; ++i) { |
39 |
if (jas_iccgetuint16(in, &curv->ents[i])) |
40 |
@@ -1100,7 +1099,7 @@ |
41 |
if (jas_iccgetuint32(in, &txtdesc->uclangcode) || |
42 |
jas_iccgetuint32(in, &txtdesc->uclen)) |
43 |
goto error; |
44 |
- if (!(txtdesc->ucdata = jas_malloc(txtdesc->uclen * 2))) |
45 |
+ if (!(txtdesc->ucdata = jas_alloc2(txtdesc->uclen, 2))) |
46 |
goto error; |
47 |
if (jas_stream_read(in, txtdesc->ucdata, txtdesc->uclen * 2) != |
48 |
JAS_CAST(int, txtdesc->uclen * 2)) |
49 |
@@ -1292,17 +1291,17 @@ |
50 |
jas_iccgetuint16(in, &lut8->numouttabents)) |
51 |
goto error; |
52 |
clutsize = jas_iccpowi(lut8->clutlen, lut8->numinchans) * lut8->numoutchans; |
53 |
- if (!(lut8->clut = jas_malloc(clutsize * sizeof(jas_iccuint8_t))) || |
54 |
- !(lut8->intabsbuf = jas_malloc(lut8->numinchans * |
55 |
- lut8->numintabents * sizeof(jas_iccuint8_t))) || |
56 |
- !(lut8->intabs = jas_malloc(lut8->numinchans * |
57 |
+ if (!(lut8->clut = jas_alloc2(clutsize, sizeof(jas_iccuint8_t))) || |
58 |
+ !(lut8->intabsbuf = jas_alloc3(lut8->numinchans, |
59 |
+ lut8->numintabents, sizeof(jas_iccuint8_t))) || |
60 |
+ !(lut8->intabs = jas_alloc2(lut8->numinchans, |
61 |
sizeof(jas_iccuint8_t *)))) |
62 |
goto error; |
63 |
for (i = 0; i < lut8->numinchans; ++i) |
64 |
lut8->intabs[i] = &lut8->intabsbuf[i * lut8->numintabents]; |
65 |
- if (!(lut8->outtabsbuf = jas_malloc(lut8->numoutchans * |
66 |
- lut8->numouttabents * sizeof(jas_iccuint8_t))) || |
67 |
- !(lut8->outtabs = jas_malloc(lut8->numoutchans * |
68 |
+ if (!(lut8->outtabsbuf = jas_alloc3(lut8->numoutchans, |
69 |
+ lut8->numouttabents, sizeof(jas_iccuint8_t))) || |
70 |
+ !(lut8->outtabs = jas_alloc2(lut8->numoutchans, |
71 |
sizeof(jas_iccuint8_t *)))) |
72 |
goto error; |
73 |
for (i = 0; i < lut8->numoutchans; ++i) |
74 |
@@ -1461,17 +1460,17 @@ |
75 |
jas_iccgetuint16(in, &lut16->numouttabents)) |
76 |
goto error; |
77 |
clutsize = jas_iccpowi(lut16->clutlen, lut16->numinchans) * lut16->numoutchans; |
78 |
- if (!(lut16->clut = jas_malloc(clutsize * sizeof(jas_iccuint16_t))) || |
79 |
- !(lut16->intabsbuf = jas_malloc(lut16->numinchans * |
80 |
- lut16->numintabents * sizeof(jas_iccuint16_t))) || |
81 |
- !(lut16->intabs = jas_malloc(lut16->numinchans * |
82 |
+ if (!(lut16->clut = jas_alloc2(clutsize, sizeof(jas_iccuint16_t))) || |
83 |
+ !(lut16->intabsbuf = jas_alloc3(lut16->numinchans, |
84 |
+ lut16->numintabents, sizeof(jas_iccuint16_t))) || |
85 |
+ !(lut16->intabs = jas_alloc2(lut16->numinchans, |
86 |
sizeof(jas_iccuint16_t *)))) |
87 |
goto error; |
88 |
for (i = 0; i < lut16->numinchans; ++i) |
89 |
lut16->intabs[i] = &lut16->intabsbuf[i * lut16->numintabents]; |
90 |
- if (!(lut16->outtabsbuf = jas_malloc(lut16->numoutchans * |
91 |
- lut16->numouttabents * sizeof(jas_iccuint16_t))) || |
92 |
- !(lut16->outtabs = jas_malloc(lut16->numoutchans * |
93 |
+ if (!(lut16->outtabsbuf = jas_alloc3(lut16->numoutchans, |
94 |
+ lut16->numouttabents, sizeof(jas_iccuint16_t))) || |
95 |
+ !(lut16->outtabs = jas_alloc2(lut16->numoutchans, |
96 |
sizeof(jas_iccuint16_t *)))) |
97 |
goto error; |
98 |
for (i = 0; i < lut16->numoutchans; ++i) |