idx
int64 | func_before
string | Vulnerability Classification
string | vul
int64 | func_after
string | patch
string | CWE ID
string | lines_before
string | lines_after
string |
|---|---|---|---|---|---|---|---|---|
800
|
void GfxICCBasedColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
#ifdef USE_CMS
if (transform != NULL && displayPixelType == PT_CMYK) {
Guchar in[gfxColorMaxComps];
Guchar out[gfxColorMaxComps];
for (int i = 0;i < nComps;i++) {
in[i] = colToByte(color->c[i]);
}
transform->doTransform(in,out,1);
cmyk->c = byteToCol(out[0]);
cmyk->m = byteToCol(out[1]);
cmyk->y = byteToCol(out[2]);
cmyk->k = byteToCol(out[3]);
} else {
GfxRGB rgb;
GfxColorComp c, m, y, k;
getRGB(color,&rgb);
c = clip01(gfxColorComp1 - rgb.r);
m = clip01(gfxColorComp1 - rgb.g);
y = clip01(gfxColorComp1 - rgb.b);
k = c;
if (m < k) {
k = m;
}
if (y < k) {
k = y;
}
cmyk->c = c - k;
cmyk->m = m - k;
cmyk->y = y - k;
cmyk->k = k;
}
#else
alt->getCMYK(color, cmyk);
#endif
}
|
DoS Exec Code Overflow
| 0
|
void GfxICCBasedColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
#ifdef USE_CMS
if (transform != NULL && displayPixelType == PT_CMYK) {
Guchar in[gfxColorMaxComps];
Guchar out[gfxColorMaxComps];
for (int i = 0;i < nComps;i++) {
in[i] = colToByte(color->c[i]);
}
transform->doTransform(in,out,1);
cmyk->c = byteToCol(out[0]);
cmyk->m = byteToCol(out[1]);
cmyk->y = byteToCol(out[2]);
cmyk->k = byteToCol(out[3]);
} else {
GfxRGB rgb;
GfxColorComp c, m, y, k;
getRGB(color,&rgb);
c = clip01(gfxColorComp1 - rgb.r);
m = clip01(gfxColorComp1 - rgb.g);
y = clip01(gfxColorComp1 - rgb.b);
k = c;
if (m < k) {
k = m;
}
if (y < k) {
k = y;
}
cmyk->c = c - k;
cmyk->m = m - k;
cmyk->y = y - k;
cmyk->k = k;
}
#else
alt->getCMYK(color, cmyk);
#endif
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
801
|
void GfxSeparationColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
double x;
double c[gfxColorMaxComps];
GfxColor color2;
int i;
x = colToDbl(color->c[0]);
func->transform(&x, c);
for (i = 0; i < alt->getNComps(); ++i) {
color2.c[i] = dblToCol(c[i]);
}
alt->getCMYK(&color2, cmyk);
}
|
DoS Exec Code Overflow
| 0
|
void GfxSeparationColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
double x;
double c[gfxColorMaxComps];
GfxColor color2;
int i;
x = colToDbl(color->c[0]);
func->transform(&x, c);
for (i = 0; i < alt->getNComps(); ++i) {
color2.c[i] = dblToCol(c[i]);
}
alt->getCMYK(&color2, cmyk);
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
802
|
void GfxDeviceNColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
double x[gfxColorMaxComps], c[gfxColorMaxComps];
GfxColor color2;
int i;
for (i = 0; i < nComps; ++i) {
x[i] = colToDbl(color->c[i]);
}
func->transform(x, c);
for (i = 0; i < alt->getNComps(); ++i) {
color2.c[i] = dblToCol(c[i]);
}
alt->getCMYK(&color2, cmyk);
}
|
DoS Exec Code Overflow
| 0
|
void GfxDeviceNColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
double x[gfxColorMaxComps], c[gfxColorMaxComps];
GfxColor color2;
int i;
for (i = 0; i < nComps; ++i) {
x[i] = colToDbl(color->c[i]);
}
func->transform(x, c);
for (i = 0; i < alt->getNComps(); ++i) {
color2.c[i] = dblToCol(c[i]);
}
alt->getCMYK(&color2, cmyk);
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
803
|
void GfxPatternColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
cmyk->c = cmyk->m = cmyk->y = 0;
cmyk->k = 1;
}
|
DoS Exec Code Overflow
| 0
|
void GfxPatternColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
cmyk->c = cmyk->m = cmyk->y = 0;
cmyk->k = 1;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
804
|
void GfxImageColorMap::getCMYK(Guchar *x, GfxCMYK *cmyk) {
GfxColor color;
int i;
if (colorSpace2) {
for (i = 0; i < nComps2; ++i) {
color.c[i] = lookup[i][x[0]];
}
colorSpace2->getCMYK(&color, cmyk);
} else {
for (i = 0; i < nComps; ++i) {
color.c[i] = lookup[i][x[i]];
}
colorSpace->getCMYK(&color, cmyk);
}
}
|
DoS Exec Code Overflow
| 0
|
void GfxImageColorMap::getCMYK(Guchar *x, GfxCMYK *cmyk) {
GfxColor color;
int i;
if (colorSpace2) {
for (i = 0; i < nComps2; ++i) {
color.c[i] = lookup[i][x[0]];
}
colorSpace2->getCMYK(&color, cmyk);
} else {
for (i = 0; i < nComps; ++i) {
color.c[i] = lookup[i][x[i]];
}
colorSpace->getCMYK(&color, cmyk);
}
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
805
|
void GfxFunctionShading::getColor(double x, double y, GfxColor *color) {
double in[2], out[gfxColorMaxComps];
int i;
for (i = 0; i < gfxColorMaxComps; ++i) {
out[i] = 0;
}
in[0] = x;
in[1] = y;
for (i = 0; i < nFuncs; ++i) {
funcs[i]->transform(in, &out[i]);
}
for (i = 0; i < gfxColorMaxComps; ++i) {
color->c[i] = dblToCol(out[i]);
}
}
|
DoS Exec Code Overflow
| 0
|
void GfxFunctionShading::getColor(double x, double y, GfxColor *color) {
double in[2], out[gfxColorMaxComps];
int i;
for (i = 0; i < gfxColorMaxComps; ++i) {
out[i] = 0;
}
in[0] = x;
in[1] = y;
for (i = 0; i < nFuncs; ++i) {
funcs[i]->transform(in, &out[i]);
}
for (i = 0; i < gfxColorMaxComps; ++i) {
color->c[i] = dblToCol(out[i]);
}
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
806
|
void GfxAxialShading::getColor(double t, GfxColor *color) {
double out[gfxColorMaxComps];
int i;
for (i = 0; i < gfxColorMaxComps; ++i) {
out[i] = 0;
}
for (i = 0; i < nFuncs; ++i) {
funcs[i]->transform(&t, &out[i]);
}
for (i = 0; i < gfxColorMaxComps; ++i) {
color->c[i] = dblToCol(out[i]);
}
}
|
DoS Exec Code Overflow
| 0
|
void GfxAxialShading::getColor(double t, GfxColor *color) {
double out[gfxColorMaxComps];
int i;
for (i = 0; i < gfxColorMaxComps; ++i) {
out[i] = 0;
}
for (i = 0; i < nFuncs; ++i) {
funcs[i]->transform(&t, &out[i]);
}
for (i = 0; i < gfxColorMaxComps; ++i) {
color->c[i] = dblToCol(out[i]);
}
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
807
|
void GfxRadialShading::getColor(double t, GfxColor *color) {
double out[gfxColorMaxComps];
int i;
for (i = 0; i < gfxColorMaxComps; ++i) {
out[i] = 0;
}
for (i = 0; i < nFuncs; ++i) {
funcs[i]->transform(&t, &out[i]);
}
for (i = 0; i < gfxColorMaxComps; ++i) {
color->c[i] = dblToCol(out[i]);
}
}
|
DoS Exec Code Overflow
| 0
|
void GfxRadialShading::getColor(double t, GfxColor *color) {
double out[gfxColorMaxComps];
int i;
for (i = 0; i < gfxColorMaxComps; ++i) {
out[i] = 0;
}
for (i = 0; i < nFuncs; ++i) {
funcs[i]->transform(&t, &out[i]);
}
for (i = 0; i < gfxColorMaxComps; ++i) {
color->c[i] = dblToCol(out[i]);
}
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
808
|
void GfxImageColorMap::getColor(Guchar *x, GfxColor *color) {
int maxPixel, i;
maxPixel = (1 << bits) - 1;
for (i = 0; i < nComps; ++i) {
color->c[i] = dblToCol(decodeLow[i] + (x[i] * decodeRange[i]) / maxPixel);
}
}
|
DoS Exec Code Overflow
| 0
|
void GfxImageColorMap::getColor(Guchar *x, GfxColor *color) {
int maxPixel, i;
maxPixel = (1 << bits) - 1;
for (i = 0; i < nComps; ++i) {
color->c[i] = dblToCol(decodeLow[i] + (x[i] * decodeRange[i]) / maxPixel);
}
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
809
|
char *GfxColorSpace::getColorSpaceModeName(int idx) {
return gfxColorSpaceModeNames[idx];
}
|
DoS Exec Code Overflow
| 0
|
char *GfxColorSpace::getColorSpaceModeName(int idx) {
return gfxColorSpaceModeNames[idx];
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
810
|
void GfxDeviceGrayColorSpace::getDefaultColor(GfxColor *color) {
color->c[0] = 0;
}
|
DoS Exec Code Overflow
| 0
|
void GfxDeviceGrayColorSpace::getDefaultColor(GfxColor *color) {
color->c[0] = 0;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
811
|
void GfxDeviceRGBColorSpace::getDefaultColor(GfxColor *color) {
color->c[0] = 0;
color->c[1] = 0;
color->c[2] = 0;
}
|
DoS Exec Code Overflow
| 0
|
void GfxDeviceRGBColorSpace::getDefaultColor(GfxColor *color) {
color->c[0] = 0;
color->c[1] = 0;
color->c[2] = 0;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
812
|
void GfxDeviceCMYKColorSpace::getDefaultColor(GfxColor *color) {
color->c[0] = 0;
color->c[1] = 0;
color->c[2] = 0;
color->c[3] = gfxColorComp1;
}
|
DoS Exec Code Overflow
| 0
|
void GfxDeviceCMYKColorSpace::getDefaultColor(GfxColor *color) {
color->c[0] = 0;
color->c[1] = 0;
color->c[2] = 0;
color->c[3] = gfxColorComp1;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
813
|
void GfxLabColorSpace::getDefaultColor(GfxColor *color) {
color->c[0] = 0;
if (aMin > 0) {
color->c[1] = dblToCol(aMin);
} else if (aMax < 0) {
color->c[1] = dblToCol(aMax);
} else {
color->c[1] = 0;
}
if (bMin > 0) {
color->c[2] = dblToCol(bMin);
} else if (bMax < 0) {
color->c[2] = dblToCol(bMax);
} else {
color->c[2] = 0;
}
}
|
DoS Exec Code Overflow
| 0
|
void GfxLabColorSpace::getDefaultColor(GfxColor *color) {
color->c[0] = 0;
if (aMin > 0) {
color->c[1] = dblToCol(aMin);
} else if (aMax < 0) {
color->c[1] = dblToCol(aMax);
} else {
color->c[1] = 0;
}
if (bMin > 0) {
color->c[2] = dblToCol(bMin);
} else if (bMax < 0) {
color->c[2] = dblToCol(bMax);
} else {
color->c[2] = 0;
}
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
814
|
void GfxICCBasedColorSpace::getDefaultColor(GfxColor *color) {
int i;
for (i = 0; i < nComps; ++i) {
if (rangeMin[i] > 0) {
color->c[i] = dblToCol(rangeMin[i]);
} else if (rangeMax[i] < 0) {
color->c[i] = dblToCol(rangeMax[i]);
} else {
color->c[i] = 0;
}
}
}
|
DoS Exec Code Overflow
| 0
|
void GfxICCBasedColorSpace::getDefaultColor(GfxColor *color) {
int i;
for (i = 0; i < nComps; ++i) {
if (rangeMin[i] > 0) {
color->c[i] = dblToCol(rangeMin[i]);
} else if (rangeMax[i] < 0) {
color->c[i] = dblToCol(rangeMax[i]);
} else {
color->c[i] = 0;
}
}
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
815
|
void GfxIndexedColorSpace::getDefaultColor(GfxColor *color) {
color->c[0] = 0;
}
|
DoS Exec Code Overflow
| 0
|
void GfxIndexedColorSpace::getDefaultColor(GfxColor *color) {
color->c[0] = 0;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
816
|
void GfxSeparationColorSpace::getDefaultColor(GfxColor *color) {
color->c[0] = gfxColorComp1;
}
|
DoS Exec Code Overflow
| 0
|
void GfxSeparationColorSpace::getDefaultColor(GfxColor *color) {
color->c[0] = gfxColorComp1;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
817
|
void GfxDeviceNColorSpace::getDefaultColor(GfxColor *color) {
int i;
for (i = 0; i < nComps; ++i) {
color->c[i] = gfxColorComp1;
}
}
|
DoS Exec Code Overflow
| 0
|
void GfxDeviceNColorSpace::getDefaultColor(GfxColor *color) {
int i;
for (i = 0; i < nComps; ++i) {
color->c[i] = gfxColorComp1;
}
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
818
|
void GfxLabColorSpace::getDefaultRanges(double *decodeLow, double *decodeRange,
int maxImgPixel) {
decodeLow[0] = 0;
decodeRange[0] = 100;
decodeLow[1] = aMin;
decodeRange[1] = aMax - aMin;
decodeLow[2] = bMin;
decodeRange[2] = bMax - bMin;
}
|
DoS Exec Code Overflow
| 0
|
void GfxLabColorSpace::getDefaultRanges(double *decodeLow, double *decodeRange,
int maxImgPixel) {
decodeLow[0] = 0;
decodeRange[0] = 100;
decodeLow[1] = aMin;
decodeRange[1] = aMax - aMin;
decodeLow[2] = bMin;
decodeRange[2] = bMax - bMin;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
819
|
void GfxICCBasedColorSpace::getDefaultRanges(double *decodeLow,
double *decodeRange,
int maxImgPixel) {
alt->getDefaultRanges(decodeLow, decodeRange, maxImgPixel);
#if 0
int i;
for (i = 0; i < nComps; ++i) {
decodeLow[i] = rangeMin[i];
decodeRange[i] = rangeMax[i] - rangeMin[i];
}
#endif
}
|
DoS Exec Code Overflow
| 0
|
void GfxICCBasedColorSpace::getDefaultRanges(double *decodeLow,
double *decodeRange,
int maxImgPixel) {
alt->getDefaultRanges(decodeLow, decodeRange, maxImgPixel);
#if 0
int i;
for (i = 0; i < nComps; ++i) {
decodeLow[i] = rangeMin[i];
decodeRange[i] = rangeMax[i] - rangeMin[i];
}
#endif
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
820
|
void GfxIndexedColorSpace::getDefaultRanges(double *decodeLow,
double *decodeRange,
int maxImgPixel) {
decodeLow[0] = 0;
decodeRange[0] = maxImgPixel;
}
|
DoS Exec Code Overflow
| 0
|
void GfxIndexedColorSpace::getDefaultRanges(double *decodeLow,
double *decodeRange,
int maxImgPixel) {
decodeLow[0] = 0;
decodeRange[0] = maxImgPixel;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
821
|
void GfxState::getFontTransMat(double *m11, double *m12,
double *m21, double *m22) {
*m11 = (textMat[0] * ctm[0] + textMat[1] * ctm[2]) * fontSize;
*m12 = (textMat[0] * ctm[1] + textMat[1] * ctm[3]) * fontSize;
*m21 = (textMat[2] * ctm[0] + textMat[3] * ctm[2]) * fontSize;
*m22 = (textMat[2] * ctm[1] + textMat[3] * ctm[3]) * fontSize;
}
|
DoS Exec Code Overflow
| 0
|
void GfxState::getFontTransMat(double *m11, double *m12,
double *m21, double *m22) {
*m11 = (textMat[0] * ctm[0] + textMat[1] * ctm[2]) * fontSize;
*m12 = (textMat[0] * ctm[1] + textMat[1] * ctm[3]) * fontSize;
*m21 = (textMat[2] * ctm[0] + textMat[3] * ctm[2]) * fontSize;
*m22 = (textMat[2] * ctm[1] + textMat[3] * ctm[3]) * fontSize;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
822
|
void GfxCalGrayColorSpace::getGray(GfxColor *color, GfxGray *gray) {
GfxRGB rgb;
#ifdef USE_CMS
if (XYZ2DisplayTransform != NULL && displayPixelType == PT_GRAY) {
Guchar out[gfxColorMaxComps];
double in[gfxColorMaxComps];
double X, Y, Z;
getXYZ(color,&X,&Y,&Z);
in[0] = clip01(X);
in[1] = clip01(Y);
in[2] = clip01(Z);
XYZ2DisplayTransform->doTransform(in,out,1);
*gray = byteToCol(out[0]);
return;
}
#endif
getRGB(color, &rgb);
*gray = clip01((GfxColorComp)(0.299 * rgb.r +
0.587 * rgb.g +
0.114 * rgb.b + 0.5));
}
|
DoS Exec Code Overflow
| 0
|
void GfxCalGrayColorSpace::getGray(GfxColor *color, GfxGray *gray) {
GfxRGB rgb;
#ifdef USE_CMS
if (XYZ2DisplayTransform != NULL && displayPixelType == PT_GRAY) {
Guchar out[gfxColorMaxComps];
double in[gfxColorMaxComps];
double X, Y, Z;
getXYZ(color,&X,&Y,&Z);
in[0] = clip01(X);
in[1] = clip01(Y);
in[2] = clip01(Z);
XYZ2DisplayTransform->doTransform(in,out,1);
*gray = byteToCol(out[0]);
return;
}
#endif
getRGB(color, &rgb);
*gray = clip01((GfxColorComp)(0.299 * rgb.r +
0.587 * rgb.g +
0.114 * rgb.b + 0.5));
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
823
|
void GfxDeviceRGBColorSpace::getGray(GfxColor *color, GfxGray *gray) {
*gray = clip01((GfxColorComp)(0.3 * color->c[0] +
0.59 * color->c[1] +
0.11 * color->c[2] + 0.5));
}
|
DoS Exec Code Overflow
| 0
|
void GfxDeviceRGBColorSpace::getGray(GfxColor *color, GfxGray *gray) {
*gray = clip01((GfxColorComp)(0.3 * color->c[0] +
0.59 * color->c[1] +
0.11 * color->c[2] + 0.5));
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
824
|
void GfxDeviceCMYKColorSpace::getGray(GfxColor *color, GfxGray *gray) {
*gray = clip01((GfxColorComp)(gfxColorComp1 - color->c[3]
- 0.3 * color->c[0]
- 0.59 * color->c[1]
- 0.11 * color->c[2] + 0.5));
}
|
DoS Exec Code Overflow
| 0
|
void GfxDeviceCMYKColorSpace::getGray(GfxColor *color, GfxGray *gray) {
*gray = clip01((GfxColorComp)(gfxColorComp1 - color->c[3]
- 0.3 * color->c[0]
- 0.59 * color->c[1]
- 0.11 * color->c[2] + 0.5));
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
825
|
void GfxICCBasedColorSpace::getGray(GfxColor *color, GfxGray *gray) {
#ifdef USE_CMS
if (transform != 0 && displayPixelType == PT_GRAY) {
Guchar in[gfxColorMaxComps];
Guchar out[gfxColorMaxComps];
for (int i = 0;i < nComps;i++) {
in[i] = colToByte(color->c[i]);
}
transform->doTransform(in,out,1);
*gray = byteToCol(out[0]);
} else {
GfxRGB rgb;
getRGB(color,&rgb);
*gray = clip01((GfxColorComp)(0.3 * rgb.r +
0.59 * rgb.g +
0.11 * rgb.b + 0.5));
}
#else
alt->getGray(color, gray);
#endif
}
|
DoS Exec Code Overflow
| 0
|
void GfxICCBasedColorSpace::getGray(GfxColor *color, GfxGray *gray) {
#ifdef USE_CMS
if (transform != 0 && displayPixelType == PT_GRAY) {
Guchar in[gfxColorMaxComps];
Guchar out[gfxColorMaxComps];
for (int i = 0;i < nComps;i++) {
in[i] = colToByte(color->c[i]);
}
transform->doTransform(in,out,1);
*gray = byteToCol(out[0]);
} else {
GfxRGB rgb;
getRGB(color,&rgb);
*gray = clip01((GfxColorComp)(0.3 * rgb.r +
0.59 * rgb.g +
0.11 * rgb.b + 0.5));
}
#else
alt->getGray(color, gray);
#endif
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
826
|
void GfxDeviceNColorSpace::getGray(GfxColor *color, GfxGray *gray) {
double x[gfxColorMaxComps], c[gfxColorMaxComps];
GfxColor color2;
int i;
for (i = 0; i < nComps; ++i) {
x[i] = colToDbl(color->c[i]);
}
func->transform(x, c);
for (i = 0; i < alt->getNComps(); ++i) {
color2.c[i] = dblToCol(c[i]);
}
alt->getGray(&color2, gray);
}
|
DoS Exec Code Overflow
| 0
|
void GfxDeviceNColorSpace::getGray(GfxColor *color, GfxGray *gray) {
double x[gfxColorMaxComps], c[gfxColorMaxComps];
GfxColor color2;
int i;
for (i = 0; i < nComps; ++i) {
x[i] = colToDbl(color->c[i]);
}
func->transform(x, c);
for (i = 0; i < alt->getNComps(); ++i) {
color2.c[i] = dblToCol(c[i]);
}
alt->getGray(&color2, gray);
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
827
|
void GfxColorSpace::getGrayLine(Guchar *in, unsigned char *out, int length) {
int i, j, n;
GfxColor color;
GfxGray gray;
n = getNComps();
for (i = 0; i < length; i++) {
for (j = 0; j < n; j++)
color.c[j] = in[i * n + j] * 256;
getGray (&color, &gray);
out[i] = colToByte(gray);
}
}
|
DoS Exec Code Overflow
| 0
|
void GfxColorSpace::getGrayLine(Guchar *in, unsigned char *out, int length) {
int i, j, n;
GfxColor color;
GfxGray gray;
n = getNComps();
for (i = 0; i < length; i++) {
for (j = 0; j < n; j++)
color.c[j] = in[i * n + j] * 256;
getGray (&color, &gray);
out[i] = colToByte(gray);
}
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
828
|
void GfxDeviceGrayColorSpace::getGrayLine(Guchar *in, Guchar *out, int length) {
memcpy (out, in, length);
}
|
DoS Exec Code Overflow
| 0
|
void GfxDeviceGrayColorSpace::getGrayLine(Guchar *in, Guchar *out, int length) {
memcpy (out, in, length);
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
829
|
void GfxDeviceRGBColorSpace::getGrayLine(Guchar *in, Guchar *out, int length) {
int i;
for (i = 0; i < length; i++) {
out[i] =
(in[i * 3 + 0] * 19595 +
in[i * 3 + 1] * 38469 +
in[i * 3 + 2] * 7472) / 65536;
}
}
|
DoS Exec Code Overflow
| 0
|
void GfxDeviceRGBColorSpace::getGrayLine(Guchar *in, Guchar *out, int length) {
int i;
for (i = 0; i < length; i++) {
out[i] =
(in[i * 3 + 0] * 19595 +
in[i * 3 + 1] * 38469 +
in[i * 3 + 2] * 7472) / 65536;
}
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
830
|
int GfxColorSpace::getNumColorSpaceModes() {
return nGfxColorSpaceModes;
}
|
DoS Exec Code Overflow
| 0
|
int GfxColorSpace::getNumColorSpaceModes() {
return nGfxColorSpaceModes;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
831
|
void GfxDeviceGrayColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
rgb->r = rgb->g = rgb->b = clip01(color->c[0]);
}
|
DoS Exec Code Overflow
| 0
|
void GfxDeviceGrayColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
rgb->r = rgb->g = rgb->b = clip01(color->c[0]);
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
832
|
void GfxCalGrayColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
double X, Y, Z;
double r, g, b;
getXYZ(color,&X,&Y,&Z);
#ifdef USE_CMS
if (XYZ2DisplayTransform != NULL && displayPixelType == PT_RGB) {
Guchar out[gfxColorMaxComps];
double in[gfxColorMaxComps];
in[0] = clip01(X);
in[1] = clip01(Y);
in[2] = clip01(Z);
XYZ2DisplayTransform->doTransform(in,out,1);
rgb->r = byteToCol(out[0]);
rgb->g = byteToCol(out[1]);
rgb->b = byteToCol(out[2]);
return;
}
#endif
X *= whiteX;
Y *= whiteY;
Z *= whiteZ;
r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z;
g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z;
b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z;
rgb->r = dblToCol(pow(clip01(r * kr), 0.5));
rgb->g = dblToCol(pow(clip01(g * kg), 0.5));
rgb->b = dblToCol(pow(clip01(b * kb), 0.5));
rgb->r = rgb->g = rgb->b = clip01(color->c[0]);
}
|
DoS Exec Code Overflow
| 0
|
void GfxCalGrayColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
double X, Y, Z;
double r, g, b;
getXYZ(color,&X,&Y,&Z);
#ifdef USE_CMS
if (XYZ2DisplayTransform != NULL && displayPixelType == PT_RGB) {
Guchar out[gfxColorMaxComps];
double in[gfxColorMaxComps];
in[0] = clip01(X);
in[1] = clip01(Y);
in[2] = clip01(Z);
XYZ2DisplayTransform->doTransform(in,out,1);
rgb->r = byteToCol(out[0]);
rgb->g = byteToCol(out[1]);
rgb->b = byteToCol(out[2]);
return;
}
#endif
X *= whiteX;
Y *= whiteY;
Z *= whiteZ;
r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z;
g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z;
b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z;
rgb->r = dblToCol(pow(clip01(r * kr), 0.5));
rgb->g = dblToCol(pow(clip01(g * kg), 0.5));
rgb->b = dblToCol(pow(clip01(b * kb), 0.5));
rgb->r = rgb->g = rgb->b = clip01(color->c[0]);
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
833
|
void GfxCalRGBColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
double X, Y, Z;
double r, g, b;
getXYZ(color,&X,&Y,&Z);
#ifdef USE_CMS
if (XYZ2DisplayTransform != NULL && displayPixelType == PT_RGB) {
Guchar out[gfxColorMaxComps];
double in[gfxColorMaxComps];
in[0] = clip01(X/whiteX);
in[1] = clip01(Y/whiteY);
in[2] = clip01(Z/whiteZ);
XYZ2DisplayTransform->doTransform(in,out,1);
rgb->r = byteToCol(out[0]);
rgb->g = byteToCol(out[1]);
rgb->b = byteToCol(out[2]);
return;
}
#endif
r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z;
g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z;
b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z;
rgb->r = dblToCol(pow(clip01(r), 0.5));
rgb->g = dblToCol(pow(clip01(g), 0.5));
rgb->b = dblToCol(pow(clip01(b), 0.5));
}
|
DoS Exec Code Overflow
| 0
|
void GfxCalRGBColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
double X, Y, Z;
double r, g, b;
getXYZ(color,&X,&Y,&Z);
#ifdef USE_CMS
if (XYZ2DisplayTransform != NULL && displayPixelType == PT_RGB) {
Guchar out[gfxColorMaxComps];
double in[gfxColorMaxComps];
in[0] = clip01(X/whiteX);
in[1] = clip01(Y/whiteY);
in[2] = clip01(Z/whiteZ);
XYZ2DisplayTransform->doTransform(in,out,1);
rgb->r = byteToCol(out[0]);
rgb->g = byteToCol(out[1]);
rgb->b = byteToCol(out[2]);
return;
}
#endif
r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z;
g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z;
b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z;
rgb->r = dblToCol(pow(clip01(r), 0.5));
rgb->g = dblToCol(pow(clip01(g), 0.5));
rgb->b = dblToCol(pow(clip01(b), 0.5));
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
834
|
void GfxDeviceCMYKColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
double c, m, y, k, c1, m1, y1, k1, r, g, b, x;
c = colToDbl(color->c[0]);
m = colToDbl(color->c[1]);
y = colToDbl(color->c[2]);
k = colToDbl(color->c[3]);
c1 = 1 - c;
m1 = 1 - m;
y1 = 1 - y;
k1 = 1 - k;
x = c1 * m1 * y1 * k1; // 0 0 0 0
r = g = b = x;
x = c1 * m1 * y1 * k; // 0 0 0 1
r += 0.1373 * x;
g += 0.1216 * x;
b += 0.1255 * x;
x = c1 * m1 * y * k1; // 0 0 1 0
r += x;
g += 0.9490 * x;
x = c1 * m1 * y * k; // 0 0 1 1
r += 0.1098 * x;
g += 0.1020 * x;
x = c1 * m * y1 * k1; // 0 1 0 0
r += 0.9255 * x;
b += 0.5490 * x;
x = c1 * m * y1 * k; // 0 1 0 1
r += 0.1412 * x;
x = c1 * m * y * k1; // 0 1 1 0
r += 0.9294 * x;
g += 0.1098 * x;
b += 0.1412 * x;
x = c1 * m * y * k; // 0 1 1 1
r += 0.1333 * x;
x = c * m1 * y1 * k1; // 1 0 0 0
g += 0.6784 * x;
b += 0.9373 * x;
x = c * m1 * y1 * k; // 1 0 0 1
g += 0.0588 * x;
b += 0.1412 * x;
x = c * m1 * y * k1; // 1 0 1 0
g += 0.6510 * x;
b += 0.3137 * x;
x = c * m1 * y * k; // 1 0 1 1
g += 0.0745 * x;
x = c * m * y1 * k1; // 1 1 0 0
r += 0.1804 * x;
g += 0.1922 * x;
b += 0.5725 * x;
x = c * m * y1 * k; // 1 1 0 1
b += 0.0078 * x;
x = c * m * y * k1; // 1 1 1 0
r += 0.2118 * x;
g += 0.2119 * x;
b += 0.2235 * x;
rgb->r = clip01(dblToCol(r));
rgb->g = clip01(dblToCol(g));
rgb->b = clip01(dblToCol(b));
}
|
DoS Exec Code Overflow
| 0
|
void GfxDeviceCMYKColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
double c, m, y, k, c1, m1, y1, k1, r, g, b, x;
c = colToDbl(color->c[0]);
m = colToDbl(color->c[1]);
y = colToDbl(color->c[2]);
k = colToDbl(color->c[3]);
c1 = 1 - c;
m1 = 1 - m;
y1 = 1 - y;
k1 = 1 - k;
x = c1 * m1 * y1 * k1; // 0 0 0 0
r = g = b = x;
x = c1 * m1 * y1 * k; // 0 0 0 1
r += 0.1373 * x;
g += 0.1216 * x;
b += 0.1255 * x;
x = c1 * m1 * y * k1; // 0 0 1 0
r += x;
g += 0.9490 * x;
x = c1 * m1 * y * k; // 0 0 1 1
r += 0.1098 * x;
g += 0.1020 * x;
x = c1 * m * y1 * k1; // 0 1 0 0
r += 0.9255 * x;
b += 0.5490 * x;
x = c1 * m * y1 * k; // 0 1 0 1
r += 0.1412 * x;
x = c1 * m * y * k1; // 0 1 1 0
r += 0.9294 * x;
g += 0.1098 * x;
b += 0.1412 * x;
x = c1 * m * y * k; // 0 1 1 1
r += 0.1333 * x;
x = c * m1 * y1 * k1; // 1 0 0 0
g += 0.6784 * x;
b += 0.9373 * x;
x = c * m1 * y1 * k; // 1 0 0 1
g += 0.0588 * x;
b += 0.1412 * x;
x = c * m1 * y * k1; // 1 0 1 0
g += 0.6510 * x;
b += 0.3137 * x;
x = c * m1 * y * k; // 1 0 1 1
g += 0.0745 * x;
x = c * m * y1 * k1; // 1 1 0 0
r += 0.1804 * x;
g += 0.1922 * x;
b += 0.5725 * x;
x = c * m * y1 * k; // 1 1 0 1
b += 0.0078 * x;
x = c * m * y * k1; // 1 1 1 0
r += 0.2118 * x;
g += 0.2119 * x;
b += 0.2235 * x;
rgb->r = clip01(dblToCol(r));
rgb->g = clip01(dblToCol(g));
rgb->b = clip01(dblToCol(b));
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
835
|
void GfxLabColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
double X, Y, Z;
double r, g, b;
getXYZ(color, &X, &Y, &Z);
#ifdef USE_CMS
if (XYZ2DisplayTransform != NULL && displayPixelType == PT_RGB) {
Guchar out[gfxColorMaxComps];
double in[gfxColorMaxComps];
in[0] = clip01(X);
in[1] = clip01(Y);
in[2] = clip01(Z);
XYZ2DisplayTransform->doTransform(in,out,1);
rgb->r = byteToCol(out[0]);
rgb->g = byteToCol(out[1]);
rgb->b = byteToCol(out[2]);
return;
}
#endif
X *= whiteX;
Y *= whiteY;
Z *= whiteZ;
r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z;
g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z;
b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z;
rgb->r = dblToCol(pow(clip01(r * kr), 0.5));
rgb->g = dblToCol(pow(clip01(g * kg), 0.5));
rgb->b = dblToCol(pow(clip01(b * kb), 0.5));
}
|
DoS Exec Code Overflow
| 0
|
void GfxLabColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
double X, Y, Z;
double r, g, b;
getXYZ(color, &X, &Y, &Z);
#ifdef USE_CMS
if (XYZ2DisplayTransform != NULL && displayPixelType == PT_RGB) {
Guchar out[gfxColorMaxComps];
double in[gfxColorMaxComps];
in[0] = clip01(X);
in[1] = clip01(Y);
in[2] = clip01(Z);
XYZ2DisplayTransform->doTransform(in,out,1);
rgb->r = byteToCol(out[0]);
rgb->g = byteToCol(out[1]);
rgb->b = byteToCol(out[2]);
return;
}
#endif
X *= whiteX;
Y *= whiteY;
Z *= whiteZ;
r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z;
g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z;
b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z;
rgb->r = dblToCol(pow(clip01(r * kr), 0.5));
rgb->g = dblToCol(pow(clip01(g * kg), 0.5));
rgb->b = dblToCol(pow(clip01(b * kb), 0.5));
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
836
|
void GfxICCBasedColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
#ifdef USE_CMS
if (transform != 0
&& (displayProfile == NULL || displayPixelType == PT_RGB)) {
Guchar in[gfxColorMaxComps];
Guchar out[gfxColorMaxComps];
for (int i = 0;i < nComps;i++) {
in[i] = colToByte(color->c[i]);
}
transform->doTransform(in,out,1);
rgb->r = byteToCol(out[0]);
rgb->g = byteToCol(out[1]);
rgb->b = byteToCol(out[2]);
} else {
alt->getRGB(color, rgb);
}
#else
alt->getRGB(color, rgb);
#endif
}
|
DoS Exec Code Overflow
| 0
|
void GfxICCBasedColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
#ifdef USE_CMS
if (transform != 0
&& (displayProfile == NULL || displayPixelType == PT_RGB)) {
Guchar in[gfxColorMaxComps];
Guchar out[gfxColorMaxComps];
for (int i = 0;i < nComps;i++) {
in[i] = colToByte(color->c[i]);
}
transform->doTransform(in,out,1);
rgb->r = byteToCol(out[0]);
rgb->g = byteToCol(out[1]);
rgb->b = byteToCol(out[2]);
} else {
alt->getRGB(color, rgb);
}
#else
alt->getRGB(color, rgb);
#endif
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
837
|
void GfxSeparationColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
double x;
double c[gfxColorMaxComps];
GfxColor color2;
int i;
x = colToDbl(color->c[0]);
func->transform(&x, c);
for (i = 0; i < alt->getNComps(); ++i) {
color2.c[i] = dblToCol(c[i]);
}
alt->getRGB(&color2, rgb);
}
|
DoS Exec Code Overflow
| 0
|
void GfxSeparationColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
double x;
double c[gfxColorMaxComps];
GfxColor color2;
int i;
x = colToDbl(color->c[0]);
func->transform(&x, c);
for (i = 0; i < alt->getNComps(); ++i) {
color2.c[i] = dblToCol(c[i]);
}
alt->getRGB(&color2, rgb);
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
838
|
void GfxDeviceNColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
double x[gfxColorMaxComps], c[gfxColorMaxComps];
GfxColor color2;
int i;
for (i = 0; i < nComps; ++i) {
x[i] = colToDbl(color->c[i]);
}
func->transform(x, c);
for (i = 0; i < alt->getNComps(); ++i) {
color2.c[i] = dblToCol(c[i]);
}
alt->getRGB(&color2, rgb);
}
|
DoS Exec Code Overflow
| 0
|
void GfxDeviceNColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
double x[gfxColorMaxComps], c[gfxColorMaxComps];
GfxColor color2;
int i;
for (i = 0; i < nComps; ++i) {
x[i] = colToDbl(color->c[i]);
}
func->transform(x, c);
for (i = 0; i < alt->getNComps(); ++i) {
color2.c[i] = dblToCol(c[i]);
}
alt->getRGB(&color2, rgb);
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
839
|
void GfxPatternColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
rgb->r = rgb->g = rgb->b = 0;
}
|
DoS Exec Code Overflow
| 0
|
void GfxPatternColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
rgb->r = rgb->g = rgb->b = 0;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
840
|
void GfxColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length) {
int i, j, n;
GfxColor color;
GfxRGB rgb;
n = getNComps();
for (i = 0; i < length; i++) {
for (j = 0; j < n; j++)
color.c[j] = in[i * n + j] * 256;
getRGB (&color, &rgb);
out[i] =
((int) colToByte(rgb.r) << 16) |
((int) colToByte(rgb.g) << 8) |
((int) colToByte(rgb.b) << 0);
}
}
|
DoS Exec Code Overflow
| 0
|
void GfxColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length) {
int i, j, n;
GfxColor color;
GfxRGB rgb;
n = getNComps();
for (i = 0; i < length; i++) {
for (j = 0; j < n; j++)
color.c[j] = in[i * n + j] * 256;
getRGB (&color, &rgb);
out[i] =
((int) colToByte(rgb.r) << 16) |
((int) colToByte(rgb.g) << 8) |
((int) colToByte(rgb.b) << 0);
}
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
841
|
void GfxICCBasedColorSpace::getRGBLine(Guchar *in, unsigned int *out,
int length) {
#ifdef USE_CMS
if (lineTransform != 0) {
for (int i = 0;i < length;i++) {
Guchar tmp[gfxColorMaxComps];
lineTransform->doTransform(in,tmp,1);
in += nComps;
out[i] = (tmp[0] << 16) | (tmp[1] << 8) | tmp[2];
}
} else {
alt->getRGBLine(in, out, length);
}
#else
alt->getRGBLine(in, out, length);
#endif
}
|
DoS Exec Code Overflow
| 0
|
void GfxICCBasedColorSpace::getRGBLine(Guchar *in, unsigned int *out,
int length) {
#ifdef USE_CMS
if (lineTransform != 0) {
for (int i = 0;i < length;i++) {
Guchar tmp[gfxColorMaxComps];
lineTransform->doTransform(in,tmp,1);
in += nComps;
out[i] = (tmp[0] << 16) | (tmp[1] << 8) | tmp[2];
}
} else {
alt->getRGBLine(in, out, length);
}
#else
alt->getRGBLine(in, out, length);
#endif
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
842
|
void GfxGouraudTriangleShading::getTriangle(
int i,
double *x0, double *y0, GfxColor *color0,
double *x1, double *y1, GfxColor *color1,
double *x2, double *y2, GfxColor *color2) {
double in;
double out[gfxColorMaxComps];
int v, j;
v = triangles[i][0];
*x0 = vertices[v].x;
*y0 = vertices[v].y;
if (nFuncs > 0) {
in = colToDbl(vertices[v].color.c[0]);
for (j = 0; j < nFuncs; ++j) {
funcs[j]->transform(&in, &out[j]);
}
for (j = 0; j < gfxColorMaxComps; ++j) {
color0->c[j] = dblToCol(out[j]);
}
} else {
*color0 = vertices[v].color;
}
v = triangles[i][1];
*x1 = vertices[v].x;
*y1 = vertices[v].y;
if (nFuncs > 0) {
in = colToDbl(vertices[v].color.c[0]);
for (j = 0; j < nFuncs; ++j) {
funcs[j]->transform(&in, &out[j]);
}
for (j = 0; j < gfxColorMaxComps; ++j) {
color1->c[j] = dblToCol(out[j]);
}
} else {
*color1 = vertices[v].color;
}
v = triangles[i][2];
*x2 = vertices[v].x;
*y2 = vertices[v].y;
if (nFuncs > 0) {
in = colToDbl(vertices[v].color.c[0]);
for (j = 0; j < nFuncs; ++j) {
funcs[j]->transform(&in, &out[j]);
}
for (j = 0; j < gfxColorMaxComps; ++j) {
color2->c[j] = dblToCol(out[j]);
}
} else {
*color2 = vertices[v].color;
}
}
|
DoS Exec Code Overflow
| 0
|
void GfxGouraudTriangleShading::getTriangle(
int i,
double *x0, double *y0, GfxColor *color0,
double *x1, double *y1, GfxColor *color1,
double *x2, double *y2, GfxColor *color2) {
double in;
double out[gfxColorMaxComps];
int v, j;
v = triangles[i][0];
*x0 = vertices[v].x;
*y0 = vertices[v].y;
if (nFuncs > 0) {
in = colToDbl(vertices[v].color.c[0]);
for (j = 0; j < nFuncs; ++j) {
funcs[j]->transform(&in, &out[j]);
}
for (j = 0; j < gfxColorMaxComps; ++j) {
color0->c[j] = dblToCol(out[j]);
}
} else {
*color0 = vertices[v].color;
}
v = triangles[i][1];
*x1 = vertices[v].x;
*y1 = vertices[v].y;
if (nFuncs > 0) {
in = colToDbl(vertices[v].color.c[0]);
for (j = 0; j < nFuncs; ++j) {
funcs[j]->transform(&in, &out[j]);
}
for (j = 0; j < gfxColorMaxComps; ++j) {
color1->c[j] = dblToCol(out[j]);
}
} else {
*color1 = vertices[v].color;
}
v = triangles[i][2];
*x2 = vertices[v].x;
*y2 = vertices[v].y;
if (nFuncs > 0) {
in = colToDbl(vertices[v].color.c[0]);
for (j = 0; j < nFuncs; ++j) {
funcs[j]->transform(&in, &out[j]);
}
for (j = 0; j < gfxColorMaxComps; ++j) {
color2->c[j] = dblToCol(out[j]);
}
} else {
*color2 = vertices[v].color;
}
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
843
|
void GfxState::getUserClipBBox(double *xMin, double *yMin,
double *xMax, double *yMax) {
double ictm[6];
double xMin1, yMin1, xMax1, yMax1, det, tx, ty;
det = 1 / (ctm[0] * ctm[3] - ctm[1] * ctm[2]);
ictm[0] = ctm[3] * det;
ictm[1] = -ctm[1] * det;
ictm[2] = -ctm[2] * det;
ictm[3] = ctm[0] * det;
ictm[4] = (ctm[2] * ctm[5] - ctm[3] * ctm[4]) * det;
ictm[5] = (ctm[1] * ctm[4] - ctm[0] * ctm[5]) * det;
xMin1 = xMax1 = clipXMin * ictm[0] + clipYMin * ictm[2] + ictm[4];
yMin1 = yMax1 = clipXMin * ictm[1] + clipYMin * ictm[3] + ictm[5];
tx = clipXMin * ictm[0] + clipYMax * ictm[2] + ictm[4];
ty = clipXMin * ictm[1] + clipYMax * ictm[3] + ictm[5];
if (tx < xMin1) {
xMin1 = tx;
} else if (tx > xMax1) {
xMax1 = tx;
}
if (ty < yMin1) {
yMin1 = ty;
} else if (ty > yMax1) {
yMax1 = ty;
}
tx = clipXMax * ictm[0] + clipYMin * ictm[2] + ictm[4];
ty = clipXMax * ictm[1] + clipYMin * ictm[3] + ictm[5];
if (tx < xMin1) {
xMin1 = tx;
} else if (tx > xMax1) {
xMax1 = tx;
}
if (ty < yMin1) {
yMin1 = ty;
} else if (ty > yMax1) {
yMax1 = ty;
}
tx = clipXMax * ictm[0] + clipYMax * ictm[2] + ictm[4];
ty = clipXMax * ictm[1] + clipYMax * ictm[3] + ictm[5];
if (tx < xMin1) {
xMin1 = tx;
} else if (tx > xMax1) {
xMax1 = tx;
}
if (ty < yMin1) {
yMin1 = ty;
} else if (ty > yMax1) {
yMax1 = ty;
}
*xMin = xMin1;
*yMin = yMin1;
*xMax = xMax1;
*yMax = yMax1;
}
|
DoS Exec Code Overflow
| 0
|
void GfxState::getUserClipBBox(double *xMin, double *yMin,
double *xMax, double *yMax) {
double ictm[6];
double xMin1, yMin1, xMax1, yMax1, det, tx, ty;
det = 1 / (ctm[0] * ctm[3] - ctm[1] * ctm[2]);
ictm[0] = ctm[3] * det;
ictm[1] = -ctm[1] * det;
ictm[2] = -ctm[2] * det;
ictm[3] = ctm[0] * det;
ictm[4] = (ctm[2] * ctm[5] - ctm[3] * ctm[4]) * det;
ictm[5] = (ctm[1] * ctm[4] - ctm[0] * ctm[5]) * det;
xMin1 = xMax1 = clipXMin * ictm[0] + clipYMin * ictm[2] + ictm[4];
yMin1 = yMax1 = clipXMin * ictm[1] + clipYMin * ictm[3] + ictm[5];
tx = clipXMin * ictm[0] + clipYMax * ictm[2] + ictm[4];
ty = clipXMin * ictm[1] + clipYMax * ictm[3] + ictm[5];
if (tx < xMin1) {
xMin1 = tx;
} else if (tx > xMax1) {
xMax1 = tx;
}
if (ty < yMin1) {
yMin1 = ty;
} else if (ty > yMax1) {
yMax1 = ty;
}
tx = clipXMax * ictm[0] + clipYMin * ictm[2] + ictm[4];
ty = clipXMax * ictm[1] + clipYMin * ictm[3] + ictm[5];
if (tx < xMin1) {
xMin1 = tx;
} else if (tx > xMax1) {
xMax1 = tx;
}
if (ty < yMin1) {
yMin1 = ty;
} else if (ty > yMax1) {
yMax1 = ty;
}
tx = clipXMax * ictm[0] + clipYMax * ictm[2] + ictm[4];
ty = clipXMax * ictm[1] + clipYMax * ictm[3] + ictm[5];
if (tx < xMin1) {
xMin1 = tx;
} else if (tx > xMax1) {
xMax1 = tx;
}
if (ty < yMin1) {
yMin1 = ty;
} else if (ty > yMax1) {
yMax1 = ty;
}
*xMin = xMin1;
*yMin = yMin1;
*xMax = xMax1;
*yMax = yMax1;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
844
|
void GfxCalRGBColorSpace::getXYZ(GfxColor *color,
double *pX, double *pY, double *pZ) {
double A, B, C;
A = colToDbl(color->c[0]);
B = colToDbl(color->c[1]);
C = colToDbl(color->c[2]);
*pX = mat[0]*pow(A,gammaR)+mat[3]*pow(B,gammaG)+mat[6]*pow(C,gammaB);
*pY = mat[1]*pow(A,gammaR)+mat[4]*pow(B,gammaG)+mat[7]*pow(C,gammaB);
*pZ = mat[2]*pow(A,gammaR)+mat[5]*pow(B,gammaG)+mat[8]*pow(C,gammaB);
}
|
DoS Exec Code Overflow
| 0
|
void GfxCalRGBColorSpace::getXYZ(GfxColor *color,
double *pX, double *pY, double *pZ) {
double A, B, C;
A = colToDbl(color->c[0]);
B = colToDbl(color->c[1]);
C = colToDbl(color->c[2]);
*pX = mat[0]*pow(A,gammaR)+mat[3]*pow(B,gammaG)+mat[6]*pow(C,gammaB);
*pY = mat[1]*pow(A,gammaR)+mat[4]*pow(B,gammaG)+mat[7]*pow(C,gammaB);
*pZ = mat[2]*pow(A,gammaR)+mat[5]*pow(B,gammaG)+mat[8]*pow(C,gammaB);
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
845
|
void GfxLabColorSpace::getXYZ(GfxColor *color,
double *pX, double *pY, double *pZ) {
double X, Y, Z;
double t1, t2;
t1 = (colToDbl(color->c[0]) + 16) / 116;
t2 = t1 + colToDbl(color->c[1]) / 500;
if (t2 >= (6.0 / 29.0)) {
X = t2 * t2 * t2;
} else {
X = (108.0 / 841.0) * (t2 - (4.0 / 29.0));
}
if (t1 >= (6.0 / 29.0)) {
Y = t1 * t1 * t1;
} else {
Y = (108.0 / 841.0) * (t1 - (4.0 / 29.0));
}
t2 = t1 - colToDbl(color->c[2]) / 200;
if (t2 >= (6.0 / 29.0)) {
Z = t2 * t2 * t2;
} else {
Z = (108.0 / 841.0) * (t2 - (4.0 / 29.0));
}
*pX = X;
*pY = Y;
*pZ = Z;
}
|
DoS Exec Code Overflow
| 0
|
void GfxLabColorSpace::getXYZ(GfxColor *color,
double *pX, double *pY, double *pZ) {
double X, Y, Z;
double t1, t2;
t1 = (colToDbl(color->c[0]) + 16) / 116;
t2 = t1 + colToDbl(color->c[1]) / 500;
if (t2 >= (6.0 / 29.0)) {
X = t2 * t2 * t2;
} else {
X = (108.0 / 841.0) * (t2 - (4.0 / 29.0));
}
if (t1 >= (6.0 / 29.0)) {
Y = t1 * t1 * t1;
} else {
Y = (108.0 / 841.0) * (t1 - (4.0 / 29.0));
}
t2 = t1 - colToDbl(color->c[2]) / 200;
if (t2 >= (6.0 / 29.0)) {
Z = t2 * t2 * t2;
} else {
Z = (108.0 / 841.0) * (t2 - (4.0 / 29.0));
}
*pX = X;
*pY = Y;
*pZ = Z;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
846
|
GBool GfxShading::init(Dict *dict) {
Object obj1, obj2;
int i;
dict->lookup("ColorSpace", &obj1);
if (!(colorSpace = GfxColorSpace::parse(&obj1))) {
error(-1, "Bad color space in shading dictionary");
obj1.free();
return gFalse;
}
obj1.free();
for (i = 0; i < gfxColorMaxComps; ++i) {
background.c[i] = 0;
}
hasBackground = gFalse;
if (dict->lookup("Background", &obj1)->isArray()) {
if (obj1.arrayGetLength() == colorSpace->getNComps()) {
hasBackground = gTrue;
for (i = 0; i < colorSpace->getNComps(); ++i) {
background.c[i] = dblToCol(obj1.arrayGet(i, &obj2)->getNum());
obj2.free();
}
} else {
error(-1, "Bad Background in shading dictionary");
}
}
obj1.free();
xMin = yMin = xMax = yMax = 0;
hasBBox = gFalse;
if (dict->lookup("BBox", &obj1)->isArray()) {
if (obj1.arrayGetLength() == 4) {
hasBBox = gTrue;
xMin = obj1.arrayGet(0, &obj2)->getNum();
obj2.free();
yMin = obj1.arrayGet(1, &obj2)->getNum();
obj2.free();
xMax = obj1.arrayGet(2, &obj2)->getNum();
obj2.free();
yMax = obj1.arrayGet(3, &obj2)->getNum();
obj2.free();
} else {
error(-1, "Bad BBox in shading dictionary");
}
}
obj1.free();
return gTrue;
}
|
DoS Exec Code Overflow
| 0
|
GBool GfxShading::init(Dict *dict) {
Object obj1, obj2;
int i;
dict->lookup("ColorSpace", &obj1);
if (!(colorSpace = GfxColorSpace::parse(&obj1))) {
error(-1, "Bad color space in shading dictionary");
obj1.free();
return gFalse;
}
obj1.free();
for (i = 0; i < gfxColorMaxComps; ++i) {
background.c[i] = 0;
}
hasBackground = gFalse;
if (dict->lookup("Background", &obj1)->isArray()) {
if (obj1.arrayGetLength() == colorSpace->getNComps()) {
hasBackground = gTrue;
for (i = 0; i < colorSpace->getNComps(); ++i) {
background.c[i] = dblToCol(obj1.arrayGet(i, &obj2)->getNum());
obj2.free();
}
} else {
error(-1, "Bad Background in shading dictionary");
}
}
obj1.free();
xMin = yMin = xMax = yMax = 0;
hasBBox = gFalse;
if (dict->lookup("BBox", &obj1)->isArray()) {
if (obj1.arrayGetLength() == 4) {
hasBBox = gTrue;
xMin = obj1.arrayGet(0, &obj2)->getNum();
obj2.free();
yMin = obj1.arrayGet(1, &obj2)->getNum();
obj2.free();
xMax = obj1.arrayGet(2, &obj2)->getNum();
obj2.free();
yMax = obj1.arrayGet(3, &obj2)->getNum();
obj2.free();
} else {
error(-1, "Bad BBox in shading dictionary");
}
}
obj1.free();
return gTrue;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
847
|
void GfxSubpath::lineTo(double x1, double y1) {
if (n >= size) {
size += 16;
x = (double *)greallocn(x, size, sizeof(double));
y = (double *)greallocn(y, size, sizeof(double));
curve = (GBool *)greallocn(curve, size, sizeof(GBool));
}
x[n] = x1;
y[n] = y1;
curve[n] = gFalse;
++n;
}
|
DoS Exec Code Overflow
| 0
|
void GfxSubpath::lineTo(double x1, double y1) {
if (n >= size) {
size += 16;
x = (double *)greallocn(x, size, sizeof(double));
y = (double *)greallocn(y, size, sizeof(double));
curve = (GBool *)greallocn(curve, size, sizeof(GBool));
}
x[n] = x1;
y[n] = y1;
curve[n] = gFalse;
++n;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
848
|
cmsHPROFILE GfxColorSpace::loadColorProfile(const char *fileName)
{
cmsHPROFILE hp = NULL;
FILE *fp;
if (fileName[0] == '/') {
if ((fp = fopen(fileName,"r")) != NULL) {
fclose(fp);
hp = cmsOpenProfileFromFile(fileName,"r");
}
return hp;
}
GooString *path = globalParams->getBaseDir();
path->append(COLOR_PROFILE_DIR);
path->append(fileName);
if ((fp = fopen(path->getCString(),"r")) != NULL) {
fclose(fp);
hp = cmsOpenProfileFromFile(path->getCString(),"r");
}
delete path;
if (hp == NULL) {
path = new GooString(GLOBAL_COLOR_PROFILE_DIR);
path->append(fileName);
if ((fp = fopen(path->getCString(),"r")) != NULL) {
fclose(fp);
hp = cmsOpenProfileFromFile(path->getCString(),"r");
}
delete path;
}
return hp;
}
|
DoS Exec Code Overflow
| 0
|
cmsHPROFILE GfxColorSpace::loadColorProfile(const char *fileName)
{
cmsHPROFILE hp = NULL;
FILE *fp;
if (fileName[0] == '/') {
if ((fp = fopen(fileName,"r")) != NULL) {
fclose(fp);
hp = cmsOpenProfileFromFile(fileName,"r");
}
return hp;
}
GooString *path = globalParams->getBaseDir();
path->append(COLOR_PROFILE_DIR);
path->append(fileName);
if ((fp = fopen(path->getCString(),"r")) != NULL) {
fclose(fp);
hp = cmsOpenProfileFromFile(path->getCString(),"r");
}
delete path;
if (hp == NULL) {
path = new GooString(GLOBAL_COLOR_PROFILE_DIR);
path->append(fileName);
if ((fp = fopen(path->getCString(),"r")) != NULL) {
fclose(fp);
hp = cmsOpenProfileFromFile(path->getCString(),"r");
}
delete path;
}
return hp;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
849
|
GfxICCBasedColorSpace *GfxICCBasedCache::lookup(int numA, int genA)
{
int i;
if (cache[0].num == numA && cache[0].gen == genA) {
return (GfxICCBasedColorSpace *)cache[0].colorSpace->copy();
}
for (i = 1;i < GFX_ICCBASED_CACHE_SIZE && cache[i].num > 0;i++) {
if (cache[i].num == numA && cache[i].gen == genA) {
int j;
GfxICCBasedCache hit = cache[i];
for (j = i;j > 0;j--) {
if (cache[j - 1].num > 0) cache[j] = cache[j-1];
}
cache[0] = hit;
return (GfxICCBasedColorSpace *)hit.colorSpace->copy();
}
}
return NULL;
}
|
DoS Exec Code Overflow
| 0
|
GfxICCBasedColorSpace *GfxICCBasedCache::lookup(int numA, int genA)
{
int i;
if (cache[0].num == numA && cache[0].gen == genA) {
return (GfxICCBasedColorSpace *)cache[0].colorSpace->copy();
}
for (i = 1;i < GFX_ICCBASED_CACHE_SIZE && cache[i].num > 0;i++) {
if (cache[i].num == numA && cache[i].gen == genA) {
int j;
GfxICCBasedCache hit = cache[i];
for (j = i;j > 0;j--) {
if (cache[j - 1].num > 0) cache[j] = cache[j-1];
}
cache[0] = hit;
return (GfxICCBasedColorSpace *)hit.colorSpace->copy();
}
}
return NULL;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
850
|
GfxColor *GfxIndexedColorSpace::mapColorToBase(GfxColor *color,
GfxColor *baseColor) {
Guchar *p;
double low[gfxColorMaxComps], range[gfxColorMaxComps];
int n, i;
n = base->getNComps();
base->getDefaultRanges(low, range, indexHigh);
p = &lookup[(int)(colToDbl(color->c[0]) + 0.5) * n];
for (i = 0; i < n; ++i) {
baseColor->c[i] = dblToCol(low[i] + (p[i] / 255.0) * range[i]);
}
return baseColor;
}
|
DoS Exec Code Overflow
| 0
|
GfxColor *GfxIndexedColorSpace::mapColorToBase(GfxColor *color,
GfxColor *baseColor) {
Guchar *p;
double low[gfxColorMaxComps], range[gfxColorMaxComps];
int n, i;
n = base->getNComps();
base->getDefaultRanges(low, range, indexHigh);
p = &lookup[(int)(colToDbl(color->c[0]) + 0.5) * n];
for (i = 0; i < n; ++i) {
baseColor->c[i] = dblToCol(low[i] + (p[i] / 255.0) * range[i]);
}
return baseColor;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
851
|
void GfxPath::moveTo(double x, double y) {
justMoved = gTrue;
firstX = x;
firstY = y;
}
|
DoS Exec Code Overflow
| 0
|
void GfxPath::moveTo(double x, double y) {
justMoved = gTrue;
firstX = x;
firstY = y;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
852
|
void GfxPath::offset(double dx, double dy) {
int i;
for (i = 0; i < n; ++i) {
subpaths[i]->offset(dx, dy);
}
}
|
DoS Exec Code Overflow
| 0
|
void GfxPath::offset(double dx, double dy) {
int i;
for (i = 0; i < n; ++i) {
subpaths[i]->offset(dx, dy);
}
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
853
|
GfxColorSpace *GfxColorSpace::parse(Object *csObj) {
GfxColorSpace *cs;
Object obj1;
cs = NULL;
if (csObj->isName()) {
if (csObj->isName("DeviceGray") || csObj->isName("G")) {
cs = new GfxDeviceGrayColorSpace();
} else if (csObj->isName("DeviceRGB") || csObj->isName("RGB")) {
cs = new GfxDeviceRGBColorSpace();
} else if (csObj->isName("DeviceCMYK") || csObj->isName("CMYK")) {
cs = new GfxDeviceCMYKColorSpace();
} else if (csObj->isName("Pattern")) {
cs = new GfxPatternColorSpace(NULL);
} else {
error(-1, "Bad color space '%s'", csObj->getName());
}
} else if (csObj->isArray()) {
csObj->arrayGet(0, &obj1);
if (obj1.isName("DeviceGray") || obj1.isName("G")) {
cs = new GfxDeviceGrayColorSpace();
} else if (obj1.isName("DeviceRGB") || obj1.isName("RGB")) {
cs = new GfxDeviceRGBColorSpace();
} else if (obj1.isName("DeviceCMYK") || obj1.isName("CMYK")) {
cs = new GfxDeviceCMYKColorSpace();
} else if (obj1.isName("CalGray")) {
cs = GfxCalGrayColorSpace::parse(csObj->getArray());
} else if (obj1.isName("CalRGB")) {
cs = GfxCalRGBColorSpace::parse(csObj->getArray());
} else if (obj1.isName("Lab")) {
cs = GfxLabColorSpace::parse(csObj->getArray());
} else if (obj1.isName("ICCBased")) {
cs = GfxICCBasedColorSpace::parse(csObj->getArray());
} else if (obj1.isName("Indexed") || obj1.isName("I")) {
cs = GfxIndexedColorSpace::parse(csObj->getArray());
} else if (obj1.isName("Separation")) {
cs = GfxSeparationColorSpace::parse(csObj->getArray());
} else if (obj1.isName("DeviceN")) {
cs = GfxDeviceNColorSpace::parse(csObj->getArray());
} else if (obj1.isName("Pattern")) {
cs = GfxPatternColorSpace::parse(csObj->getArray());
} else {
error(-1, "Bad color space");
}
obj1.free();
} else {
error(-1, "Bad color space - expected name or array");
}
return cs;
}
|
DoS Exec Code Overflow
| 0
|
GfxColorSpace *GfxColorSpace::parse(Object *csObj) {
GfxColorSpace *cs;
Object obj1;
cs = NULL;
if (csObj->isName()) {
if (csObj->isName("DeviceGray") || csObj->isName("G")) {
cs = new GfxDeviceGrayColorSpace();
} else if (csObj->isName("DeviceRGB") || csObj->isName("RGB")) {
cs = new GfxDeviceRGBColorSpace();
} else if (csObj->isName("DeviceCMYK") || csObj->isName("CMYK")) {
cs = new GfxDeviceCMYKColorSpace();
} else if (csObj->isName("Pattern")) {
cs = new GfxPatternColorSpace(NULL);
} else {
error(-1, "Bad color space '%s'", csObj->getName());
}
} else if (csObj->isArray()) {
csObj->arrayGet(0, &obj1);
if (obj1.isName("DeviceGray") || obj1.isName("G")) {
cs = new GfxDeviceGrayColorSpace();
} else if (obj1.isName("DeviceRGB") || obj1.isName("RGB")) {
cs = new GfxDeviceRGBColorSpace();
} else if (obj1.isName("DeviceCMYK") || obj1.isName("CMYK")) {
cs = new GfxDeviceCMYKColorSpace();
} else if (obj1.isName("CalGray")) {
cs = GfxCalGrayColorSpace::parse(csObj->getArray());
} else if (obj1.isName("CalRGB")) {
cs = GfxCalRGBColorSpace::parse(csObj->getArray());
} else if (obj1.isName("Lab")) {
cs = GfxLabColorSpace::parse(csObj->getArray());
} else if (obj1.isName("ICCBased")) {
cs = GfxICCBasedColorSpace::parse(csObj->getArray());
} else if (obj1.isName("Indexed") || obj1.isName("I")) {
cs = GfxIndexedColorSpace::parse(csObj->getArray());
} else if (obj1.isName("Separation")) {
cs = GfxSeparationColorSpace::parse(csObj->getArray());
} else if (obj1.isName("DeviceN")) {
cs = GfxDeviceNColorSpace::parse(csObj->getArray());
} else if (obj1.isName("Pattern")) {
cs = GfxPatternColorSpace::parse(csObj->getArray());
} else {
error(-1, "Bad color space");
}
obj1.free();
} else {
error(-1, "Bad color space - expected name or array");
}
return cs;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
854
|
GfxColorSpace *GfxCalGrayColorSpace::parse(Array *arr) {
GfxCalGrayColorSpace *cs;
Object obj1, obj2, obj3;
arr->get(1, &obj1);
if (!obj1.isDict()) {
error(-1, "Bad CalGray color space");
obj1.free();
return NULL;
}
cs = new GfxCalGrayColorSpace();
if (obj1.dictLookup("WhitePoint", &obj2)->isArray() &&
obj2.arrayGetLength() == 3) {
obj2.arrayGet(0, &obj3);
cs->whiteX = obj3.getNum();
obj3.free();
obj2.arrayGet(1, &obj3);
cs->whiteY = obj3.getNum();
obj3.free();
obj2.arrayGet(2, &obj3);
cs->whiteZ = obj3.getNum();
obj3.free();
}
obj2.free();
if (obj1.dictLookup("BlackPoint", &obj2)->isArray() &&
obj2.arrayGetLength() == 3) {
obj2.arrayGet(0, &obj3);
cs->blackX = obj3.getNum();
obj3.free();
obj2.arrayGet(1, &obj3);
cs->blackY = obj3.getNum();
obj3.free();
obj2.arrayGet(2, &obj3);
cs->blackZ = obj3.getNum();
obj3.free();
}
obj2.free();
if (obj1.dictLookup("Gamma", &obj2)->isNum()) {
cs->gamma = obj2.getNum();
}
obj2.free();
obj1.free();
cs->kr = 1 / (xyzrgb[0][0] * cs->whiteX +
xyzrgb[0][1] * cs->whiteY +
xyzrgb[0][2] * cs->whiteZ);
cs->kg = 1 / (xyzrgb[1][0] * cs->whiteX +
xyzrgb[1][1] * cs->whiteY +
xyzrgb[1][2] * cs->whiteZ);
cs->kb = 1 / (xyzrgb[2][0] * cs->whiteX +
xyzrgb[2][1] * cs->whiteY +
xyzrgb[2][2] * cs->whiteZ);
return cs;
}
|
DoS Exec Code Overflow
| 0
|
GfxColorSpace *GfxCalGrayColorSpace::parse(Array *arr) {
GfxCalGrayColorSpace *cs;
Object obj1, obj2, obj3;
arr->get(1, &obj1);
if (!obj1.isDict()) {
error(-1, "Bad CalGray color space");
obj1.free();
return NULL;
}
cs = new GfxCalGrayColorSpace();
if (obj1.dictLookup("WhitePoint", &obj2)->isArray() &&
obj2.arrayGetLength() == 3) {
obj2.arrayGet(0, &obj3);
cs->whiteX = obj3.getNum();
obj3.free();
obj2.arrayGet(1, &obj3);
cs->whiteY = obj3.getNum();
obj3.free();
obj2.arrayGet(2, &obj3);
cs->whiteZ = obj3.getNum();
obj3.free();
}
obj2.free();
if (obj1.dictLookup("BlackPoint", &obj2)->isArray() &&
obj2.arrayGetLength() == 3) {
obj2.arrayGet(0, &obj3);
cs->blackX = obj3.getNum();
obj3.free();
obj2.arrayGet(1, &obj3);
cs->blackY = obj3.getNum();
obj3.free();
obj2.arrayGet(2, &obj3);
cs->blackZ = obj3.getNum();
obj3.free();
}
obj2.free();
if (obj1.dictLookup("Gamma", &obj2)->isNum()) {
cs->gamma = obj2.getNum();
}
obj2.free();
obj1.free();
cs->kr = 1 / (xyzrgb[0][0] * cs->whiteX +
xyzrgb[0][1] * cs->whiteY +
xyzrgb[0][2] * cs->whiteZ);
cs->kg = 1 / (xyzrgb[1][0] * cs->whiteX +
xyzrgb[1][1] * cs->whiteY +
xyzrgb[1][2] * cs->whiteZ);
cs->kb = 1 / (xyzrgb[2][0] * cs->whiteX +
xyzrgb[2][1] * cs->whiteY +
xyzrgb[2][2] * cs->whiteZ);
return cs;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
855
|
GfxColorSpace *GfxCalRGBColorSpace::parse(Array *arr) {
GfxCalRGBColorSpace *cs;
Object obj1, obj2, obj3;
int i;
arr->get(1, &obj1);
if (!obj1.isDict()) {
error(-1, "Bad CalRGB color space");
obj1.free();
return NULL;
}
cs = new GfxCalRGBColorSpace();
if (obj1.dictLookup("WhitePoint", &obj2)->isArray() &&
obj2.arrayGetLength() == 3) {
obj2.arrayGet(0, &obj3);
cs->whiteX = obj3.getNum();
obj3.free();
obj2.arrayGet(1, &obj3);
cs->whiteY = obj3.getNum();
obj3.free();
obj2.arrayGet(2, &obj3);
cs->whiteZ = obj3.getNum();
obj3.free();
}
obj2.free();
if (obj1.dictLookup("BlackPoint", &obj2)->isArray() &&
obj2.arrayGetLength() == 3) {
obj2.arrayGet(0, &obj3);
cs->blackX = obj3.getNum();
obj3.free();
obj2.arrayGet(1, &obj3);
cs->blackY = obj3.getNum();
obj3.free();
obj2.arrayGet(2, &obj3);
cs->blackZ = obj3.getNum();
obj3.free();
}
obj2.free();
if (obj1.dictLookup("Gamma", &obj2)->isArray() &&
obj2.arrayGetLength() == 3) {
obj2.arrayGet(0, &obj3);
cs->gammaR = obj3.getNum();
obj3.free();
obj2.arrayGet(1, &obj3);
cs->gammaG = obj3.getNum();
obj3.free();
obj2.arrayGet(2, &obj3);
cs->gammaB = obj3.getNum();
obj3.free();
}
obj2.free();
if (obj1.dictLookup("Matrix", &obj2)->isArray() &&
obj2.arrayGetLength() == 9) {
for (i = 0; i < 9; ++i) {
obj2.arrayGet(i, &obj3);
cs->mat[i] = obj3.getNum();
obj3.free();
}
}
obj2.free();
obj1.free();
cs->kr = 1 / (xyzrgb[0][0] * cs->whiteX +
xyzrgb[0][1] * cs->whiteY +
xyzrgb[0][2] * cs->whiteZ);
cs->kg = 1 / (xyzrgb[1][0] * cs->whiteX +
xyzrgb[1][1] * cs->whiteY +
xyzrgb[1][2] * cs->whiteZ);
cs->kb = 1 / (xyzrgb[2][0] * cs->whiteX +
xyzrgb[2][1] * cs->whiteY +
xyzrgb[2][2] * cs->whiteZ);
return cs;
}
|
DoS Exec Code Overflow
| 0
|
GfxColorSpace *GfxCalRGBColorSpace::parse(Array *arr) {
GfxCalRGBColorSpace *cs;
Object obj1, obj2, obj3;
int i;
arr->get(1, &obj1);
if (!obj1.isDict()) {
error(-1, "Bad CalRGB color space");
obj1.free();
return NULL;
}
cs = new GfxCalRGBColorSpace();
if (obj1.dictLookup("WhitePoint", &obj2)->isArray() &&
obj2.arrayGetLength() == 3) {
obj2.arrayGet(0, &obj3);
cs->whiteX = obj3.getNum();
obj3.free();
obj2.arrayGet(1, &obj3);
cs->whiteY = obj3.getNum();
obj3.free();
obj2.arrayGet(2, &obj3);
cs->whiteZ = obj3.getNum();
obj3.free();
}
obj2.free();
if (obj1.dictLookup("BlackPoint", &obj2)->isArray() &&
obj2.arrayGetLength() == 3) {
obj2.arrayGet(0, &obj3);
cs->blackX = obj3.getNum();
obj3.free();
obj2.arrayGet(1, &obj3);
cs->blackY = obj3.getNum();
obj3.free();
obj2.arrayGet(2, &obj3);
cs->blackZ = obj3.getNum();
obj3.free();
}
obj2.free();
if (obj1.dictLookup("Gamma", &obj2)->isArray() &&
obj2.arrayGetLength() == 3) {
obj2.arrayGet(0, &obj3);
cs->gammaR = obj3.getNum();
obj3.free();
obj2.arrayGet(1, &obj3);
cs->gammaG = obj3.getNum();
obj3.free();
obj2.arrayGet(2, &obj3);
cs->gammaB = obj3.getNum();
obj3.free();
}
obj2.free();
if (obj1.dictLookup("Matrix", &obj2)->isArray() &&
obj2.arrayGetLength() == 9) {
for (i = 0; i < 9; ++i) {
obj2.arrayGet(i, &obj3);
cs->mat[i] = obj3.getNum();
obj3.free();
}
}
obj2.free();
obj1.free();
cs->kr = 1 / (xyzrgb[0][0] * cs->whiteX +
xyzrgb[0][1] * cs->whiteY +
xyzrgb[0][2] * cs->whiteZ);
cs->kg = 1 / (xyzrgb[1][0] * cs->whiteX +
xyzrgb[1][1] * cs->whiteY +
xyzrgb[1][2] * cs->whiteZ);
cs->kb = 1 / (xyzrgb[2][0] * cs->whiteX +
xyzrgb[2][1] * cs->whiteY +
xyzrgb[2][2] * cs->whiteZ);
return cs;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
856
|
GfxColorSpace *GfxLabColorSpace::parse(Array *arr) {
GfxLabColorSpace *cs;
Object obj1, obj2, obj3;
arr->get(1, &obj1);
if (!obj1.isDict()) {
error(-1, "Bad Lab color space");
obj1.free();
return NULL;
}
cs = new GfxLabColorSpace();
if (obj1.dictLookup("WhitePoint", &obj2)->isArray() &&
obj2.arrayGetLength() == 3) {
obj2.arrayGet(0, &obj3);
cs->whiteX = obj3.getNum();
obj3.free();
obj2.arrayGet(1, &obj3);
cs->whiteY = obj3.getNum();
obj3.free();
obj2.arrayGet(2, &obj3);
cs->whiteZ = obj3.getNum();
obj3.free();
}
obj2.free();
if (obj1.dictLookup("BlackPoint", &obj2)->isArray() &&
obj2.arrayGetLength() == 3) {
obj2.arrayGet(0, &obj3);
cs->blackX = obj3.getNum();
obj3.free();
obj2.arrayGet(1, &obj3);
cs->blackY = obj3.getNum();
obj3.free();
obj2.arrayGet(2, &obj3);
cs->blackZ = obj3.getNum();
obj3.free();
}
obj2.free();
if (obj1.dictLookup("Range", &obj2)->isArray() &&
obj2.arrayGetLength() == 4) {
obj2.arrayGet(0, &obj3);
cs->aMin = obj3.getNum();
obj3.free();
obj2.arrayGet(1, &obj3);
cs->aMax = obj3.getNum();
obj3.free();
obj2.arrayGet(2, &obj3);
cs->bMin = obj3.getNum();
obj3.free();
obj2.arrayGet(3, &obj3);
cs->bMax = obj3.getNum();
obj3.free();
}
obj2.free();
obj1.free();
cs->kr = 1 / (xyzrgb[0][0] * cs->whiteX +
xyzrgb[0][1] * cs->whiteY +
xyzrgb[0][2] * cs->whiteZ);
cs->kg = 1 / (xyzrgb[1][0] * cs->whiteX +
xyzrgb[1][1] * cs->whiteY +
xyzrgb[1][2] * cs->whiteZ);
cs->kb = 1 / (xyzrgb[2][0] * cs->whiteX +
xyzrgb[2][1] * cs->whiteY +
xyzrgb[2][2] * cs->whiteZ);
return cs;
}
|
DoS Exec Code Overflow
| 0
|
GfxColorSpace *GfxLabColorSpace::parse(Array *arr) {
GfxLabColorSpace *cs;
Object obj1, obj2, obj3;
arr->get(1, &obj1);
if (!obj1.isDict()) {
error(-1, "Bad Lab color space");
obj1.free();
return NULL;
}
cs = new GfxLabColorSpace();
if (obj1.dictLookup("WhitePoint", &obj2)->isArray() &&
obj2.arrayGetLength() == 3) {
obj2.arrayGet(0, &obj3);
cs->whiteX = obj3.getNum();
obj3.free();
obj2.arrayGet(1, &obj3);
cs->whiteY = obj3.getNum();
obj3.free();
obj2.arrayGet(2, &obj3);
cs->whiteZ = obj3.getNum();
obj3.free();
}
obj2.free();
if (obj1.dictLookup("BlackPoint", &obj2)->isArray() &&
obj2.arrayGetLength() == 3) {
obj2.arrayGet(0, &obj3);
cs->blackX = obj3.getNum();
obj3.free();
obj2.arrayGet(1, &obj3);
cs->blackY = obj3.getNum();
obj3.free();
obj2.arrayGet(2, &obj3);
cs->blackZ = obj3.getNum();
obj3.free();
}
obj2.free();
if (obj1.dictLookup("Range", &obj2)->isArray() &&
obj2.arrayGetLength() == 4) {
obj2.arrayGet(0, &obj3);
cs->aMin = obj3.getNum();
obj3.free();
obj2.arrayGet(1, &obj3);
cs->aMax = obj3.getNum();
obj3.free();
obj2.arrayGet(2, &obj3);
cs->bMin = obj3.getNum();
obj3.free();
obj2.arrayGet(3, &obj3);
cs->bMax = obj3.getNum();
obj3.free();
}
obj2.free();
obj1.free();
cs->kr = 1 / (xyzrgb[0][0] * cs->whiteX +
xyzrgb[0][1] * cs->whiteY +
xyzrgb[0][2] * cs->whiteZ);
cs->kg = 1 / (xyzrgb[1][0] * cs->whiteX +
xyzrgb[1][1] * cs->whiteY +
xyzrgb[1][2] * cs->whiteZ);
cs->kb = 1 / (xyzrgb[2][0] * cs->whiteX +
xyzrgb[2][1] * cs->whiteY +
xyzrgb[2][2] * cs->whiteZ);
return cs;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
857
|
GfxColorSpace *GfxICCBasedColorSpace::parse(Array *arr) {
GfxICCBasedColorSpace *cs;
Ref iccProfileStreamA;
int nCompsA;
GfxColorSpace *altA;
Dict *dict;
Object obj1, obj2, obj3;
int i;
arr->getNF(1, &obj1);
if (obj1.isRef()) {
iccProfileStreamA = obj1.getRef();
} else {
iccProfileStreamA.num = 0;
iccProfileStreamA.gen = 0;
}
obj1.free();
#ifdef USE_CMS
if (iccProfileStreamA.num > 0
&& (cs = GfxICCBasedCache::lookup(iccProfileStreamA.num,
iccProfileStreamA.gen)) != NULL) return cs;
#endif
arr->get(1, &obj1);
if (!obj1.isStream()) {
error(-1, "Bad ICCBased color space (stream)");
obj1.free();
return NULL;
}
dict = obj1.streamGetDict();
if (!dict->lookup("N", &obj2)->isInt()) {
error(-1, "Bad ICCBased color space (N)");
obj2.free();
obj1.free();
return NULL;
}
nCompsA = obj2.getInt();
obj2.free();
if (nCompsA > gfxColorMaxComps) {
error(-1, "ICCBased color space with too many (%d > %d) components",
nCompsA, gfxColorMaxComps);
nCompsA = gfxColorMaxComps;
}
if (dict->lookup("Alternate", &obj2)->isNull() ||
!(altA = GfxColorSpace::parse(&obj2))) {
switch (nCompsA) {
case 1:
altA = new GfxDeviceGrayColorSpace();
break;
case 3:
altA = new GfxDeviceRGBColorSpace();
break;
case 4:
altA = new GfxDeviceCMYKColorSpace();
break;
default:
error(-1, "Bad ICCBased color space - invalid N");
obj2.free();
obj1.free();
return NULL;
}
}
obj2.free();
cs = new GfxICCBasedColorSpace(nCompsA, altA, &iccProfileStreamA);
if (dict->lookup("Range", &obj2)->isArray() &&
obj2.arrayGetLength() == 2 * nCompsA) {
for (i = 0; i < nCompsA; ++i) {
obj2.arrayGet(2*i, &obj3);
cs->rangeMin[i] = obj3.getNum();
obj3.free();
obj2.arrayGet(2*i+1, &obj3);
cs->rangeMax[i] = obj3.getNum();
obj3.free();
}
}
obj2.free();
obj1.free();
#ifdef USE_CMS
arr->get(1, &obj1);
dict = obj1.streamGetDict();
Guchar *profBuf;
unsigned int bufSize;
Stream *iccStream = obj1.getStream();
int c;
unsigned int size = 0;
bufSize = 65536;
profBuf = (Guchar *)gmallocn(bufSize,1);
iccStream->reset();
while ((c = iccStream->getChar()) != EOF) {
if (bufSize <= size) {
bufSize += 65536;
profBuf = (Guchar *)greallocn(profBuf,bufSize,1);
}
profBuf[size++] = c;
}
cmsHPROFILE hp = cmsOpenProfileFromMem(profBuf,size);
gfree(profBuf);
if (hp == 0) {
error(-1, "read ICCBased color space profile error");
} else {
cmsHPROFILE dhp = displayProfile;
if (dhp == NULL) dhp = RGBProfile;
unsigned int cst = getCMSColorSpaceType(cmsGetColorSpace(hp));
unsigned int dNChannels = getCMSNChannels(cmsGetColorSpace(dhp));
unsigned int dcst = getCMSColorSpaceType(cmsGetColorSpace(dhp));
cmsHTRANSFORM transform;
if ((transform = cmsCreateTransform(hp,
COLORSPACE_SH(cst) |CHANNELS_SH(nCompsA) | BYTES_SH(1),
dhp,
COLORSPACE_SH(dcst) |
CHANNELS_SH(dNChannels) | BYTES_SH(1),
INTENT_RELATIVE_COLORIMETRIC,0)) == 0) {
error(-1, "Can't create transform");
}
cs->transform = new GfxColorTransform(transform);
if (dcst == PT_RGB) {
if ((transform = cmsCreateTransform(hp,
CHANNELS_SH(nCompsA) | BYTES_SH(1),dhp,
TYPE_RGB_8,INTENT_RELATIVE_COLORIMETRIC,0)) == 0) {
error(-1, "Can't create transform");
}
cs->lineTransform = new GfxColorTransform(transform);
}
cmsCloseProfile(hp);
}
obj1.free();
if (iccProfileStreamA.num > 0) {
GfxICCBasedCache::put(iccProfileStreamA.num,iccProfileStreamA.gen,cs);
}
#endif
return cs;
}
|
DoS Exec Code Overflow
| 0
|
GfxColorSpace *GfxICCBasedColorSpace::parse(Array *arr) {
GfxICCBasedColorSpace *cs;
Ref iccProfileStreamA;
int nCompsA;
GfxColorSpace *altA;
Dict *dict;
Object obj1, obj2, obj3;
int i;
arr->getNF(1, &obj1);
if (obj1.isRef()) {
iccProfileStreamA = obj1.getRef();
} else {
iccProfileStreamA.num = 0;
iccProfileStreamA.gen = 0;
}
obj1.free();
#ifdef USE_CMS
if (iccProfileStreamA.num > 0
&& (cs = GfxICCBasedCache::lookup(iccProfileStreamA.num,
iccProfileStreamA.gen)) != NULL) return cs;
#endif
arr->get(1, &obj1);
if (!obj1.isStream()) {
error(-1, "Bad ICCBased color space (stream)");
obj1.free();
return NULL;
}
dict = obj1.streamGetDict();
if (!dict->lookup("N", &obj2)->isInt()) {
error(-1, "Bad ICCBased color space (N)");
obj2.free();
obj1.free();
return NULL;
}
nCompsA = obj2.getInt();
obj2.free();
if (nCompsA > gfxColorMaxComps) {
error(-1, "ICCBased color space with too many (%d > %d) components",
nCompsA, gfxColorMaxComps);
nCompsA = gfxColorMaxComps;
}
if (dict->lookup("Alternate", &obj2)->isNull() ||
!(altA = GfxColorSpace::parse(&obj2))) {
switch (nCompsA) {
case 1:
altA = new GfxDeviceGrayColorSpace();
break;
case 3:
altA = new GfxDeviceRGBColorSpace();
break;
case 4:
altA = new GfxDeviceCMYKColorSpace();
break;
default:
error(-1, "Bad ICCBased color space - invalid N");
obj2.free();
obj1.free();
return NULL;
}
}
obj2.free();
cs = new GfxICCBasedColorSpace(nCompsA, altA, &iccProfileStreamA);
if (dict->lookup("Range", &obj2)->isArray() &&
obj2.arrayGetLength() == 2 * nCompsA) {
for (i = 0; i < nCompsA; ++i) {
obj2.arrayGet(2*i, &obj3);
cs->rangeMin[i] = obj3.getNum();
obj3.free();
obj2.arrayGet(2*i+1, &obj3);
cs->rangeMax[i] = obj3.getNum();
obj3.free();
}
}
obj2.free();
obj1.free();
#ifdef USE_CMS
arr->get(1, &obj1);
dict = obj1.streamGetDict();
Guchar *profBuf;
unsigned int bufSize;
Stream *iccStream = obj1.getStream();
int c;
unsigned int size = 0;
bufSize = 65536;
profBuf = (Guchar *)gmallocn(bufSize,1);
iccStream->reset();
while ((c = iccStream->getChar()) != EOF) {
if (bufSize <= size) {
bufSize += 65536;
profBuf = (Guchar *)greallocn(profBuf,bufSize,1);
}
profBuf[size++] = c;
}
cmsHPROFILE hp = cmsOpenProfileFromMem(profBuf,size);
gfree(profBuf);
if (hp == 0) {
error(-1, "read ICCBased color space profile error");
} else {
cmsHPROFILE dhp = displayProfile;
if (dhp == NULL) dhp = RGBProfile;
unsigned int cst = getCMSColorSpaceType(cmsGetColorSpace(hp));
unsigned int dNChannels = getCMSNChannels(cmsGetColorSpace(dhp));
unsigned int dcst = getCMSColorSpaceType(cmsGetColorSpace(dhp));
cmsHTRANSFORM transform;
if ((transform = cmsCreateTransform(hp,
COLORSPACE_SH(cst) |CHANNELS_SH(nCompsA) | BYTES_SH(1),
dhp,
COLORSPACE_SH(dcst) |
CHANNELS_SH(dNChannels) | BYTES_SH(1),
INTENT_RELATIVE_COLORIMETRIC,0)) == 0) {
error(-1, "Can't create transform");
}
cs->transform = new GfxColorTransform(transform);
if (dcst == PT_RGB) {
if ((transform = cmsCreateTransform(hp,
CHANNELS_SH(nCompsA) | BYTES_SH(1),dhp,
TYPE_RGB_8,INTENT_RELATIVE_COLORIMETRIC,0)) == 0) {
error(-1, "Can't create transform");
}
cs->lineTransform = new GfxColorTransform(transform);
}
cmsCloseProfile(hp);
}
obj1.free();
if (iccProfileStreamA.num > 0) {
GfxICCBasedCache::put(iccProfileStreamA.num,iccProfileStreamA.gen,cs);
}
#endif
return cs;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
858
|
GfxColorSpace *GfxSeparationColorSpace::parse(Array *arr) {
GfxSeparationColorSpace *cs;
GooString *nameA;
GfxColorSpace *altA;
Function *funcA;
Object obj1;
if (arr->getLength() != 4) {
error(-1, "Bad Separation color space");
goto err1;
}
if (!arr->get(1, &obj1)->isName()) {
error(-1, "Bad Separation color space (name)");
goto err2;
}
nameA = new GooString(obj1.getName());
obj1.free();
arr->get(2, &obj1);
if (!(altA = GfxColorSpace::parse(&obj1))) {
error(-1, "Bad Separation color space (alternate color space)");
goto err3;
}
obj1.free();
arr->get(3, &obj1);
if (!(funcA = Function::parse(&obj1))) {
goto err4;
}
obj1.free();
cs = new GfxSeparationColorSpace(nameA, altA, funcA);
return cs;
err4:
delete altA;
err3:
delete nameA;
err2:
obj1.free();
err1:
return NULL;
}
|
DoS Exec Code Overflow
| 0
|
GfxColorSpace *GfxSeparationColorSpace::parse(Array *arr) {
GfxSeparationColorSpace *cs;
GooString *nameA;
GfxColorSpace *altA;
Function *funcA;
Object obj1;
if (arr->getLength() != 4) {
error(-1, "Bad Separation color space");
goto err1;
}
if (!arr->get(1, &obj1)->isName()) {
error(-1, "Bad Separation color space (name)");
goto err2;
}
nameA = new GooString(obj1.getName());
obj1.free();
arr->get(2, &obj1);
if (!(altA = GfxColorSpace::parse(&obj1))) {
error(-1, "Bad Separation color space (alternate color space)");
goto err3;
}
obj1.free();
arr->get(3, &obj1);
if (!(funcA = Function::parse(&obj1))) {
goto err4;
}
obj1.free();
cs = new GfxSeparationColorSpace(nameA, altA, funcA);
return cs;
err4:
delete altA;
err3:
delete nameA;
err2:
obj1.free();
err1:
return NULL;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
859
|
GfxColorSpace *GfxDeviceNColorSpace::parse(Array *arr) {
GfxDeviceNColorSpace *cs;
int nCompsA;
GooString *namesA[gfxColorMaxComps];
GfxColorSpace *altA;
Function *funcA;
Object obj1, obj2;
int i;
if (arr->getLength() != 4 && arr->getLength() != 5) {
error(-1, "Bad DeviceN color space");
goto err1;
}
if (!arr->get(1, &obj1)->isArray()) {
error(-1, "Bad DeviceN color space (names)");
goto err2;
}
nCompsA = obj1.arrayGetLength();
if (nCompsA > gfxColorMaxComps) {
error(-1, "DeviceN color space with too many (%d > %d) components",
nCompsA, gfxColorMaxComps);
nCompsA = gfxColorMaxComps;
}
for (i = 0; i < nCompsA; ++i) {
if (!obj1.arrayGet(i, &obj2)->isName()) {
error(-1, "Bad DeviceN color space (names)");
obj2.free();
goto err2;
}
namesA[i] = new GooString(obj2.getName());
obj2.free();
}
obj1.free();
arr->get(2, &obj1);
if (!(altA = GfxColorSpace::parse(&obj1))) {
error(-1, "Bad DeviceN color space (alternate color space)");
goto err3;
}
obj1.free();
arr->get(3, &obj1);
if (!(funcA = Function::parse(&obj1))) {
goto err4;
}
obj1.free();
cs = new GfxDeviceNColorSpace(nCompsA, altA, funcA);
cs->nonMarking = gTrue;
for (i = 0; i < nCompsA; ++i) {
cs->names[i] = namesA[i];
if (namesA[i]->cmp("None")) {
cs->nonMarking = gFalse;
}
}
return cs;
err4:
delete altA;
err3:
for (i = 0; i < nCompsA; ++i) {
delete namesA[i];
}
err2:
obj1.free();
err1:
return NULL;
}
|
DoS Exec Code Overflow
| 0
|
GfxColorSpace *GfxDeviceNColorSpace::parse(Array *arr) {
GfxDeviceNColorSpace *cs;
int nCompsA;
GooString *namesA[gfxColorMaxComps];
GfxColorSpace *altA;
Function *funcA;
Object obj1, obj2;
int i;
if (arr->getLength() != 4 && arr->getLength() != 5) {
error(-1, "Bad DeviceN color space");
goto err1;
}
if (!arr->get(1, &obj1)->isArray()) {
error(-1, "Bad DeviceN color space (names)");
goto err2;
}
nCompsA = obj1.arrayGetLength();
if (nCompsA > gfxColorMaxComps) {
error(-1, "DeviceN color space with too many (%d > %d) components",
nCompsA, gfxColorMaxComps);
nCompsA = gfxColorMaxComps;
}
for (i = 0; i < nCompsA; ++i) {
if (!obj1.arrayGet(i, &obj2)->isName()) {
error(-1, "Bad DeviceN color space (names)");
obj2.free();
goto err2;
}
namesA[i] = new GooString(obj2.getName());
obj2.free();
}
obj1.free();
arr->get(2, &obj1);
if (!(altA = GfxColorSpace::parse(&obj1))) {
error(-1, "Bad DeviceN color space (alternate color space)");
goto err3;
}
obj1.free();
arr->get(3, &obj1);
if (!(funcA = Function::parse(&obj1))) {
goto err4;
}
obj1.free();
cs = new GfxDeviceNColorSpace(nCompsA, altA, funcA);
cs->nonMarking = gTrue;
for (i = 0; i < nCompsA; ++i) {
cs->names[i] = namesA[i];
if (namesA[i]->cmp("None")) {
cs->nonMarking = gFalse;
}
}
return cs;
err4:
delete altA;
err3:
for (i = 0; i < nCompsA; ++i) {
delete namesA[i];
}
err2:
obj1.free();
err1:
return NULL;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
860
|
GfxColorSpace *GfxPatternColorSpace::parse(Array *arr) {
GfxPatternColorSpace *cs;
GfxColorSpace *underA;
Object obj1;
if (arr->getLength() != 1 && arr->getLength() != 2) {
error(-1, "Bad Pattern color space");
return NULL;
}
underA = NULL;
if (arr->getLength() == 2) {
arr->get(1, &obj1);
if (!(underA = GfxColorSpace::parse(&obj1))) {
error(-1, "Bad Pattern color space (underlying color space)");
obj1.free();
return NULL;
}
obj1.free();
}
cs = new GfxPatternColorSpace(underA);
return cs;
}
|
DoS Exec Code Overflow
| 0
|
GfxColorSpace *GfxPatternColorSpace::parse(Array *arr) {
GfxPatternColorSpace *cs;
GfxColorSpace *underA;
Object obj1;
if (arr->getLength() != 1 && arr->getLength() != 2) {
error(-1, "Bad Pattern color space");
return NULL;
}
underA = NULL;
if (arr->getLength() == 2) {
arr->get(1, &obj1);
if (!(underA = GfxColorSpace::parse(&obj1))) {
error(-1, "Bad Pattern color space (underlying color space)");
obj1.free();
return NULL;
}
obj1.free();
}
cs = new GfxPatternColorSpace(underA);
return cs;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
861
|
GfxPattern *GfxPattern::parse(Object *obj) {
GfxPattern *pattern;
Object obj1;
if (obj->isDict()) {
obj->dictLookup("PatternType", &obj1);
} else if (obj->isStream()) {
obj->streamGetDict()->lookup("PatternType", &obj1);
} else {
return NULL;
}
pattern = NULL;
if (obj1.isInt() && obj1.getInt() == 1) {
pattern = GfxTilingPattern::parse(obj);
} else if (obj1.isInt() && obj1.getInt() == 2) {
pattern = GfxShadingPattern::parse(obj);
}
obj1.free();
return pattern;
}
|
DoS Exec Code Overflow
| 0
|
GfxPattern *GfxPattern::parse(Object *obj) {
GfxPattern *pattern;
Object obj1;
if (obj->isDict()) {
obj->dictLookup("PatternType", &obj1);
} else if (obj->isStream()) {
obj->streamGetDict()->lookup("PatternType", &obj1);
} else {
return NULL;
}
pattern = NULL;
if (obj1.isInt() && obj1.getInt() == 1) {
pattern = GfxTilingPattern::parse(obj);
} else if (obj1.isInt() && obj1.getInt() == 2) {
pattern = GfxShadingPattern::parse(obj);
}
obj1.free();
return pattern;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
862
|
GfxTilingPattern *GfxTilingPattern::parse(Object *patObj) {
GfxTilingPattern *pat;
Dict *dict;
int paintTypeA, tilingTypeA;
double bboxA[4], matrixA[6];
double xStepA, yStepA;
Object resDictA;
Object obj1, obj2;
int i;
if (!patObj->isStream()) {
return NULL;
}
dict = patObj->streamGetDict();
if (dict->lookup("PaintType", &obj1)->isInt()) {
paintTypeA = obj1.getInt();
} else {
paintTypeA = 1;
error(-1, "Invalid or missing PaintType in pattern");
}
obj1.free();
if (dict->lookup("TilingType", &obj1)->isInt()) {
tilingTypeA = obj1.getInt();
} else {
tilingTypeA = 1;
error(-1, "Invalid or missing TilingType in pattern");
}
obj1.free();
bboxA[0] = bboxA[1] = 0;
bboxA[2] = bboxA[3] = 1;
if (dict->lookup("BBox", &obj1)->isArray() &&
obj1.arrayGetLength() == 4) {
for (i = 0; i < 4; ++i) {
if (obj1.arrayGet(i, &obj2)->isNum()) {
bboxA[i] = obj2.getNum();
}
obj2.free();
}
} else {
error(-1, "Invalid or missing BBox in pattern");
}
obj1.free();
if (dict->lookup("XStep", &obj1)->isNum()) {
xStepA = obj1.getNum();
} else {
xStepA = 1;
error(-1, "Invalid or missing XStep in pattern");
}
obj1.free();
if (dict->lookup("YStep", &obj1)->isNum()) {
yStepA = obj1.getNum();
} else {
yStepA = 1;
error(-1, "Invalid or missing YStep in pattern");
}
obj1.free();
if (!dict->lookup("Resources", &resDictA)->isDict()) {
resDictA.free();
resDictA.initNull();
error(-1, "Invalid or missing Resources in pattern");
}
matrixA[0] = 1; matrixA[1] = 0;
matrixA[2] = 0; matrixA[3] = 1;
matrixA[4] = 0; matrixA[5] = 0;
if (dict->lookup("Matrix", &obj1)->isArray() &&
obj1.arrayGetLength() == 6) {
for (i = 0; i < 6; ++i) {
if (obj1.arrayGet(i, &obj2)->isNum()) {
matrixA[i] = obj2.getNum();
}
obj2.free();
}
}
obj1.free();
pat = new GfxTilingPattern(paintTypeA, tilingTypeA, bboxA, xStepA, yStepA,
&resDictA, matrixA, patObj);
resDictA.free();
return pat;
}
|
DoS Exec Code Overflow
| 0
|
GfxTilingPattern *GfxTilingPattern::parse(Object *patObj) {
GfxTilingPattern *pat;
Dict *dict;
int paintTypeA, tilingTypeA;
double bboxA[4], matrixA[6];
double xStepA, yStepA;
Object resDictA;
Object obj1, obj2;
int i;
if (!patObj->isStream()) {
return NULL;
}
dict = patObj->streamGetDict();
if (dict->lookup("PaintType", &obj1)->isInt()) {
paintTypeA = obj1.getInt();
} else {
paintTypeA = 1;
error(-1, "Invalid or missing PaintType in pattern");
}
obj1.free();
if (dict->lookup("TilingType", &obj1)->isInt()) {
tilingTypeA = obj1.getInt();
} else {
tilingTypeA = 1;
error(-1, "Invalid or missing TilingType in pattern");
}
obj1.free();
bboxA[0] = bboxA[1] = 0;
bboxA[2] = bboxA[3] = 1;
if (dict->lookup("BBox", &obj1)->isArray() &&
obj1.arrayGetLength() == 4) {
for (i = 0; i < 4; ++i) {
if (obj1.arrayGet(i, &obj2)->isNum()) {
bboxA[i] = obj2.getNum();
}
obj2.free();
}
} else {
error(-1, "Invalid or missing BBox in pattern");
}
obj1.free();
if (dict->lookup("XStep", &obj1)->isNum()) {
xStepA = obj1.getNum();
} else {
xStepA = 1;
error(-1, "Invalid or missing XStep in pattern");
}
obj1.free();
if (dict->lookup("YStep", &obj1)->isNum()) {
yStepA = obj1.getNum();
} else {
yStepA = 1;
error(-1, "Invalid or missing YStep in pattern");
}
obj1.free();
if (!dict->lookup("Resources", &resDictA)->isDict()) {
resDictA.free();
resDictA.initNull();
error(-1, "Invalid or missing Resources in pattern");
}
matrixA[0] = 1; matrixA[1] = 0;
matrixA[2] = 0; matrixA[3] = 1;
matrixA[4] = 0; matrixA[5] = 0;
if (dict->lookup("Matrix", &obj1)->isArray() &&
obj1.arrayGetLength() == 6) {
for (i = 0; i < 6; ++i) {
if (obj1.arrayGet(i, &obj2)->isNum()) {
matrixA[i] = obj2.getNum();
}
obj2.free();
}
}
obj1.free();
pat = new GfxTilingPattern(paintTypeA, tilingTypeA, bboxA, xStepA, yStepA,
&resDictA, matrixA, patObj);
resDictA.free();
return pat;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
863
|
GfxShadingPattern *GfxShadingPattern::parse(Object *patObj) {
Dict *dict;
GfxShading *shadingA;
double matrixA[6];
Object obj1, obj2;
int i;
if (!patObj->isDict()) {
return NULL;
}
dict = patObj->getDict();
dict->lookup("Shading", &obj1);
shadingA = GfxShading::parse(&obj1);
obj1.free();
if (!shadingA) {
return NULL;
}
matrixA[0] = 1; matrixA[1] = 0;
matrixA[2] = 0; matrixA[3] = 1;
matrixA[4] = 0; matrixA[5] = 0;
if (dict->lookup("Matrix", &obj1)->isArray() &&
obj1.arrayGetLength() == 6) {
for (i = 0; i < 6; ++i) {
if (obj1.arrayGet(i, &obj2)->isNum()) {
matrixA[i] = obj2.getNum();
}
obj2.free();
}
}
obj1.free();
return new GfxShadingPattern(shadingA, matrixA);
}
|
DoS Exec Code Overflow
| 0
|
GfxShadingPattern *GfxShadingPattern::parse(Object *patObj) {
Dict *dict;
GfxShading *shadingA;
double matrixA[6];
Object obj1, obj2;
int i;
if (!patObj->isDict()) {
return NULL;
}
dict = patObj->getDict();
dict->lookup("Shading", &obj1);
shadingA = GfxShading::parse(&obj1);
obj1.free();
if (!shadingA) {
return NULL;
}
matrixA[0] = 1; matrixA[1] = 0;
matrixA[2] = 0; matrixA[3] = 1;
matrixA[4] = 0; matrixA[5] = 0;
if (dict->lookup("Matrix", &obj1)->isArray() &&
obj1.arrayGetLength() == 6) {
for (i = 0; i < 6; ++i) {
if (obj1.arrayGet(i, &obj2)->isNum()) {
matrixA[i] = obj2.getNum();
}
obj2.free();
}
}
obj1.free();
return new GfxShadingPattern(shadingA, matrixA);
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
864
|
GfxFunctionShading *GfxFunctionShading::parse(Dict *dict) {
GfxFunctionShading *shading;
double x0A, y0A, x1A, y1A;
double matrixA[6];
Function *funcsA[gfxColorMaxComps];
int nFuncsA;
Object obj1, obj2;
int i;
x0A = y0A = 0;
x1A = y1A = 1;
if (dict->lookup("Domain", &obj1)->isArray() &&
obj1.arrayGetLength() == 4) {
x0A = obj1.arrayGet(0, &obj2)->getNum();
obj2.free();
x1A = obj1.arrayGet(1, &obj2)->getNum();
obj2.free();
y0A = obj1.arrayGet(2, &obj2)->getNum();
obj2.free();
y1A = obj1.arrayGet(3, &obj2)->getNum();
obj2.free();
}
obj1.free();
matrixA[0] = 1; matrixA[1] = 0;
matrixA[2] = 0; matrixA[3] = 1;
matrixA[4] = 0; matrixA[5] = 0;
if (dict->lookup("Matrix", &obj1)->isArray() &&
obj1.arrayGetLength() == 6) {
matrixA[0] = obj1.arrayGet(0, &obj2)->getNum();
obj2.free();
matrixA[1] = obj1.arrayGet(1, &obj2)->getNum();
obj2.free();
matrixA[2] = obj1.arrayGet(2, &obj2)->getNum();
obj2.free();
matrixA[3] = obj1.arrayGet(3, &obj2)->getNum();
obj2.free();
matrixA[4] = obj1.arrayGet(4, &obj2)->getNum();
obj2.free();
matrixA[5] = obj1.arrayGet(5, &obj2)->getNum();
obj2.free();
}
obj1.free();
dict->lookup("Function", &obj1);
if (obj1.isArray()) {
nFuncsA = obj1.arrayGetLength();
if (nFuncsA > gfxColorMaxComps) {
error(-1, "Invalid Function array in shading dictionary");
goto err1;
}
for (i = 0; i < nFuncsA; ++i) {
obj1.arrayGet(i, &obj2);
if (!(funcsA[i] = Function::parse(&obj2))) {
goto err2;
}
obj2.free();
}
} else {
nFuncsA = 1;
if (!(funcsA[0] = Function::parse(&obj1))) {
goto err1;
}
}
obj1.free();
shading = new GfxFunctionShading(x0A, y0A, x1A, y1A, matrixA,
funcsA, nFuncsA);
if (!shading->init(dict)) {
delete shading;
return NULL;
}
return shading;
err2:
obj2.free();
err1:
obj1.free();
return NULL;
}
|
DoS Exec Code Overflow
| 0
|
GfxFunctionShading *GfxFunctionShading::parse(Dict *dict) {
GfxFunctionShading *shading;
double x0A, y0A, x1A, y1A;
double matrixA[6];
Function *funcsA[gfxColorMaxComps];
int nFuncsA;
Object obj1, obj2;
int i;
x0A = y0A = 0;
x1A = y1A = 1;
if (dict->lookup("Domain", &obj1)->isArray() &&
obj1.arrayGetLength() == 4) {
x0A = obj1.arrayGet(0, &obj2)->getNum();
obj2.free();
x1A = obj1.arrayGet(1, &obj2)->getNum();
obj2.free();
y0A = obj1.arrayGet(2, &obj2)->getNum();
obj2.free();
y1A = obj1.arrayGet(3, &obj2)->getNum();
obj2.free();
}
obj1.free();
matrixA[0] = 1; matrixA[1] = 0;
matrixA[2] = 0; matrixA[3] = 1;
matrixA[4] = 0; matrixA[5] = 0;
if (dict->lookup("Matrix", &obj1)->isArray() &&
obj1.arrayGetLength() == 6) {
matrixA[0] = obj1.arrayGet(0, &obj2)->getNum();
obj2.free();
matrixA[1] = obj1.arrayGet(1, &obj2)->getNum();
obj2.free();
matrixA[2] = obj1.arrayGet(2, &obj2)->getNum();
obj2.free();
matrixA[3] = obj1.arrayGet(3, &obj2)->getNum();
obj2.free();
matrixA[4] = obj1.arrayGet(4, &obj2)->getNum();
obj2.free();
matrixA[5] = obj1.arrayGet(5, &obj2)->getNum();
obj2.free();
}
obj1.free();
dict->lookup("Function", &obj1);
if (obj1.isArray()) {
nFuncsA = obj1.arrayGetLength();
if (nFuncsA > gfxColorMaxComps) {
error(-1, "Invalid Function array in shading dictionary");
goto err1;
}
for (i = 0; i < nFuncsA; ++i) {
obj1.arrayGet(i, &obj2);
if (!(funcsA[i] = Function::parse(&obj2))) {
goto err2;
}
obj2.free();
}
} else {
nFuncsA = 1;
if (!(funcsA[0] = Function::parse(&obj1))) {
goto err1;
}
}
obj1.free();
shading = new GfxFunctionShading(x0A, y0A, x1A, y1A, matrixA,
funcsA, nFuncsA);
if (!shading->init(dict)) {
delete shading;
return NULL;
}
return shading;
err2:
obj2.free();
err1:
obj1.free();
return NULL;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
865
|
GfxAxialShading *GfxAxialShading::parse(Dict *dict) {
GfxAxialShading *shading;
double x0A, y0A, x1A, y1A;
double t0A, t1A;
Function *funcsA[gfxColorMaxComps];
int nFuncsA;
GBool extend0A, extend1A;
Object obj1, obj2;
int i;
x0A = y0A = x1A = y1A = 0;
if (dict->lookup("Coords", &obj1)->isArray() &&
obj1.arrayGetLength() == 4) {
x0A = obj1.arrayGet(0, &obj2)->getNum();
obj2.free();
y0A = obj1.arrayGet(1, &obj2)->getNum();
obj2.free();
x1A = obj1.arrayGet(2, &obj2)->getNum();
obj2.free();
y1A = obj1.arrayGet(3, &obj2)->getNum();
obj2.free();
} else {
error(-1, "Missing or invalid Coords in shading dictionary");
goto err1;
}
obj1.free();
t0A = 0;
t1A = 1;
if (dict->lookup("Domain", &obj1)->isArray() &&
obj1.arrayGetLength() == 2) {
t0A = obj1.arrayGet(0, &obj2)->getNum();
obj2.free();
t1A = obj1.arrayGet(1, &obj2)->getNum();
obj2.free();
}
obj1.free();
dict->lookup("Function", &obj1);
if (obj1.isArray()) {
nFuncsA = obj1.arrayGetLength();
if (nFuncsA > gfxColorMaxComps) {
error(-1, "Invalid Function array in shading dictionary");
goto err1;
}
for (i = 0; i < nFuncsA; ++i) {
obj1.arrayGet(i, &obj2);
if (!(funcsA[i] = Function::parse(&obj2))) {
obj1.free();
obj2.free();
goto err1;
}
obj2.free();
}
} else {
nFuncsA = 1;
if (!(funcsA[0] = Function::parse(&obj1))) {
obj1.free();
goto err1;
}
}
obj1.free();
extend0A = extend1A = gFalse;
if (dict->lookup("Extend", &obj1)->isArray() &&
obj1.arrayGetLength() == 2) {
extend0A = obj1.arrayGet(0, &obj2)->getBool();
obj2.free();
extend1A = obj1.arrayGet(1, &obj2)->getBool();
obj2.free();
}
obj1.free();
shading = new GfxAxialShading(x0A, y0A, x1A, y1A, t0A, t1A,
funcsA, nFuncsA, extend0A, extend1A);
if (!shading->init(dict)) {
delete shading;
return NULL;
}
return shading;
err1:
return NULL;
}
|
DoS Exec Code Overflow
| 0
|
GfxAxialShading *GfxAxialShading::parse(Dict *dict) {
GfxAxialShading *shading;
double x0A, y0A, x1A, y1A;
double t0A, t1A;
Function *funcsA[gfxColorMaxComps];
int nFuncsA;
GBool extend0A, extend1A;
Object obj1, obj2;
int i;
x0A = y0A = x1A = y1A = 0;
if (dict->lookup("Coords", &obj1)->isArray() &&
obj1.arrayGetLength() == 4) {
x0A = obj1.arrayGet(0, &obj2)->getNum();
obj2.free();
y0A = obj1.arrayGet(1, &obj2)->getNum();
obj2.free();
x1A = obj1.arrayGet(2, &obj2)->getNum();
obj2.free();
y1A = obj1.arrayGet(3, &obj2)->getNum();
obj2.free();
} else {
error(-1, "Missing or invalid Coords in shading dictionary");
goto err1;
}
obj1.free();
t0A = 0;
t1A = 1;
if (dict->lookup("Domain", &obj1)->isArray() &&
obj1.arrayGetLength() == 2) {
t0A = obj1.arrayGet(0, &obj2)->getNum();
obj2.free();
t1A = obj1.arrayGet(1, &obj2)->getNum();
obj2.free();
}
obj1.free();
dict->lookup("Function", &obj1);
if (obj1.isArray()) {
nFuncsA = obj1.arrayGetLength();
if (nFuncsA > gfxColorMaxComps) {
error(-1, "Invalid Function array in shading dictionary");
goto err1;
}
for (i = 0; i < nFuncsA; ++i) {
obj1.arrayGet(i, &obj2);
if (!(funcsA[i] = Function::parse(&obj2))) {
obj1.free();
obj2.free();
goto err1;
}
obj2.free();
}
} else {
nFuncsA = 1;
if (!(funcsA[0] = Function::parse(&obj1))) {
obj1.free();
goto err1;
}
}
obj1.free();
extend0A = extend1A = gFalse;
if (dict->lookup("Extend", &obj1)->isArray() &&
obj1.arrayGetLength() == 2) {
extend0A = obj1.arrayGet(0, &obj2)->getBool();
obj2.free();
extend1A = obj1.arrayGet(1, &obj2)->getBool();
obj2.free();
}
obj1.free();
shading = new GfxAxialShading(x0A, y0A, x1A, y1A, t0A, t1A,
funcsA, nFuncsA, extend0A, extend1A);
if (!shading->init(dict)) {
delete shading;
return NULL;
}
return shading;
err1:
return NULL;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
866
|
GfxRadialShading *GfxRadialShading::parse(Dict *dict) {
GfxRadialShading *shading;
double x0A, y0A, r0A, x1A, y1A, r1A;
double t0A, t1A;
Function *funcsA[gfxColorMaxComps];
int nFuncsA;
GBool extend0A, extend1A;
Object obj1, obj2;
int i;
x0A = y0A = r0A = x1A = y1A = r1A = 0;
if (dict->lookup("Coords", &obj1)->isArray() &&
obj1.arrayGetLength() == 6) {
x0A = obj1.arrayGet(0, &obj2)->getNum();
obj2.free();
y0A = obj1.arrayGet(1, &obj2)->getNum();
obj2.free();
r0A = obj1.arrayGet(2, &obj2)->getNum();
obj2.free();
x1A = obj1.arrayGet(3, &obj2)->getNum();
obj2.free();
y1A = obj1.arrayGet(4, &obj2)->getNum();
obj2.free();
r1A = obj1.arrayGet(5, &obj2)->getNum();
obj2.free();
} else {
error(-1, "Missing or invalid Coords in shading dictionary");
goto err1;
}
obj1.free();
t0A = 0;
t1A = 1;
if (dict->lookup("Domain", &obj1)->isArray() &&
obj1.arrayGetLength() == 2) {
t0A = obj1.arrayGet(0, &obj2)->getNum();
obj2.free();
t1A = obj1.arrayGet(1, &obj2)->getNum();
obj2.free();
}
obj1.free();
dict->lookup("Function", &obj1);
if (obj1.isArray()) {
nFuncsA = obj1.arrayGetLength();
if (nFuncsA > gfxColorMaxComps) {
error(-1, "Invalid Function array in shading dictionary");
goto err1;
}
for (i = 0; i < nFuncsA; ++i) {
obj1.arrayGet(i, &obj2);
if (!(funcsA[i] = Function::parse(&obj2))) {
obj1.free();
obj2.free();
goto err1;
}
obj2.free();
}
} else {
nFuncsA = 1;
if (!(funcsA[0] = Function::parse(&obj1))) {
obj1.free();
goto err1;
}
}
obj1.free();
extend0A = extend1A = gFalse;
if (dict->lookup("Extend", &obj1)->isArray() &&
obj1.arrayGetLength() == 2) {
extend0A = obj1.arrayGet(0, &obj2)->getBool();
obj2.free();
extend1A = obj1.arrayGet(1, &obj2)->getBool();
obj2.free();
}
obj1.free();
shading = new GfxRadialShading(x0A, y0A, r0A, x1A, y1A, r1A, t0A, t1A,
funcsA, nFuncsA, extend0A, extend1A);
if (!shading->init(dict)) {
delete shading;
return NULL;
}
return shading;
err1:
return NULL;
}
|
DoS Exec Code Overflow
| 0
|
GfxRadialShading *GfxRadialShading::parse(Dict *dict) {
GfxRadialShading *shading;
double x0A, y0A, r0A, x1A, y1A, r1A;
double t0A, t1A;
Function *funcsA[gfxColorMaxComps];
int nFuncsA;
GBool extend0A, extend1A;
Object obj1, obj2;
int i;
x0A = y0A = r0A = x1A = y1A = r1A = 0;
if (dict->lookup("Coords", &obj1)->isArray() &&
obj1.arrayGetLength() == 6) {
x0A = obj1.arrayGet(0, &obj2)->getNum();
obj2.free();
y0A = obj1.arrayGet(1, &obj2)->getNum();
obj2.free();
r0A = obj1.arrayGet(2, &obj2)->getNum();
obj2.free();
x1A = obj1.arrayGet(3, &obj2)->getNum();
obj2.free();
y1A = obj1.arrayGet(4, &obj2)->getNum();
obj2.free();
r1A = obj1.arrayGet(5, &obj2)->getNum();
obj2.free();
} else {
error(-1, "Missing or invalid Coords in shading dictionary");
goto err1;
}
obj1.free();
t0A = 0;
t1A = 1;
if (dict->lookup("Domain", &obj1)->isArray() &&
obj1.arrayGetLength() == 2) {
t0A = obj1.arrayGet(0, &obj2)->getNum();
obj2.free();
t1A = obj1.arrayGet(1, &obj2)->getNum();
obj2.free();
}
obj1.free();
dict->lookup("Function", &obj1);
if (obj1.isArray()) {
nFuncsA = obj1.arrayGetLength();
if (nFuncsA > gfxColorMaxComps) {
error(-1, "Invalid Function array in shading dictionary");
goto err1;
}
for (i = 0; i < nFuncsA; ++i) {
obj1.arrayGet(i, &obj2);
if (!(funcsA[i] = Function::parse(&obj2))) {
obj1.free();
obj2.free();
goto err1;
}
obj2.free();
}
} else {
nFuncsA = 1;
if (!(funcsA[0] = Function::parse(&obj1))) {
obj1.free();
goto err1;
}
}
obj1.free();
extend0A = extend1A = gFalse;
if (dict->lookup("Extend", &obj1)->isArray() &&
obj1.arrayGetLength() == 2) {
extend0A = obj1.arrayGet(0, &obj2)->getBool();
obj2.free();
extend1A = obj1.arrayGet(1, &obj2)->getBool();
obj2.free();
}
obj1.free();
shading = new GfxRadialShading(x0A, y0A, r0A, x1A, y1A, r1A, t0A, t1A,
funcsA, nFuncsA, extend0A, extend1A);
if (!shading->init(dict)) {
delete shading;
return NULL;
}
return shading;
err1:
return NULL;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
867
|
GfxGouraudTriangleShading *GfxGouraudTriangleShading::parse(int typeA,
Dict *dict,
Stream *str) {
GfxGouraudTriangleShading *shading;
Function *funcsA[gfxColorMaxComps];
int nFuncsA;
int coordBits, compBits, flagBits, vertsPerRow, nRows;
double xMin, xMax, yMin, yMax;
double cMin[gfxColorMaxComps], cMax[gfxColorMaxComps];
double xMul, yMul;
double cMul[gfxColorMaxComps];
GfxGouraudVertex *verticesA;
int (*trianglesA)[3];
int nComps, nVerticesA, nTrianglesA, vertSize, triSize;
Guint x, y, flag;
Guint c[gfxColorMaxComps];
GfxShadingBitBuf *bitBuf;
Object obj1, obj2;
int i, j, k, state;
if (dict->lookup("BitsPerCoordinate", &obj1)->isInt()) {
coordBits = obj1.getInt();
} else {
error(-1, "Missing or invalid BitsPerCoordinate in shading dictionary");
goto err2;
}
obj1.free();
if (dict->lookup("BitsPerComponent", &obj1)->isInt()) {
compBits = obj1.getInt();
} else {
error(-1, "Missing or invalid BitsPerComponent in shading dictionary");
goto err2;
}
obj1.free();
flagBits = vertsPerRow = 0; // make gcc happy
if (typeA == 4) {
if (dict->lookup("BitsPerFlag", &obj1)->isInt()) {
flagBits = obj1.getInt();
} else {
error(-1, "Missing or invalid BitsPerFlag in shading dictionary");
goto err2;
}
obj1.free();
} else {
if (dict->lookup("VerticesPerRow", &obj1)->isInt()) {
vertsPerRow = obj1.getInt();
} else {
error(-1, "Missing or invalid VerticesPerRow in shading dictionary");
goto err2;
}
obj1.free();
}
if (dict->lookup("Decode", &obj1)->isArray() &&
obj1.arrayGetLength() >= 6) {
xMin = obj1.arrayGet(0, &obj2)->getNum();
obj2.free();
xMax = obj1.arrayGet(1, &obj2)->getNum();
obj2.free();
xMul = (xMax - xMin) / (pow(2.0, coordBits) - 1);
yMin = obj1.arrayGet(2, &obj2)->getNum();
obj2.free();
yMax = obj1.arrayGet(3, &obj2)->getNum();
obj2.free();
yMul = (yMax - yMin) / (pow(2.0, coordBits) - 1);
for (i = 0; 5 + 2*i < obj1.arrayGetLength() && i < gfxColorMaxComps; ++i) {
cMin[i] = obj1.arrayGet(4 + 2*i, &obj2)->getNum();
obj2.free();
cMax[i] = obj1.arrayGet(5 + 2*i, &obj2)->getNum();
obj2.free();
cMul[i] = (cMax[i] - cMin[i]) / (double)((1 << compBits) - 1);
}
nComps = i;
} else {
error(-1, "Missing or invalid Decode array in shading dictionary");
goto err2;
}
obj1.free();
if (!dict->lookup("Function", &obj1)->isNull()) {
if (obj1.isArray()) {
nFuncsA = obj1.arrayGetLength();
if (nFuncsA > gfxColorMaxComps) {
error(-1, "Invalid Function array in shading dictionary");
goto err1;
}
for (i = 0; i < nFuncsA; ++i) {
obj1.arrayGet(i, &obj2);
if (!(funcsA[i] = Function::parse(&obj2))) {
obj1.free();
obj2.free();
goto err1;
}
obj2.free();
}
} else {
nFuncsA = 1;
if (!(funcsA[0] = Function::parse(&obj1))) {
obj1.free();
goto err1;
}
}
} else {
nFuncsA = 0;
}
obj1.free();
nVerticesA = nTrianglesA = 0;
verticesA = NULL;
trianglesA = NULL;
vertSize = triSize = 0;
state = 0;
flag = 0; // make gcc happy
bitBuf = new GfxShadingBitBuf(str);
while (1) {
if (typeA == 4) {
if (!bitBuf->getBits(flagBits, &flag)) {
break;
}
}
if (!bitBuf->getBits(coordBits, &x) ||
!bitBuf->getBits(coordBits, &y)) {
break;
}
for (i = 0; i < nComps; ++i) {
if (!bitBuf->getBits(compBits, &c[i])) {
break;
}
}
if (i < nComps) {
break;
}
if (nVerticesA == vertSize) {
vertSize = (vertSize == 0) ? 16 : 2 * vertSize;
verticesA = (GfxGouraudVertex *)
greallocn(verticesA, vertSize, sizeof(GfxGouraudVertex));
}
verticesA[nVerticesA].x = xMin + xMul * (double)x;
verticesA[nVerticesA].y = yMin + yMul * (double)y;
for (i = 0; i < nComps; ++i) {
verticesA[nVerticesA].color.c[i] =
dblToCol(cMin[i] + cMul[i] * (double)c[i]);
}
++nVerticesA;
bitBuf->flushBits();
if (typeA == 4) {
if (state == 0 || state == 1) {
++state;
} else if (state == 2 || flag > 0) {
if (nTrianglesA == triSize) {
triSize = (triSize == 0) ? 16 : 2 * triSize;
trianglesA = (int (*)[3])
greallocn(trianglesA, triSize * 3, sizeof(int));
}
if (state == 2) {
trianglesA[nTrianglesA][0] = nVerticesA - 3;
trianglesA[nTrianglesA][1] = nVerticesA - 2;
trianglesA[nTrianglesA][2] = nVerticesA - 1;
++state;
} else if (flag == 1) {
trianglesA[nTrianglesA][0] = trianglesA[nTrianglesA - 1][1];
trianglesA[nTrianglesA][1] = trianglesA[nTrianglesA - 1][2];
trianglesA[nTrianglesA][2] = nVerticesA - 1;
} else { // flag == 2
trianglesA[nTrianglesA][0] = trianglesA[nTrianglesA - 1][0];
trianglesA[nTrianglesA][1] = trianglesA[nTrianglesA - 1][2];
trianglesA[nTrianglesA][2] = nVerticesA - 1;
}
++nTrianglesA;
} else { // state == 3 && flag == 0
state = 1;
}
}
}
delete bitBuf;
if (typeA == 5) {
nRows = nVerticesA / vertsPerRow;
nTrianglesA = (nRows - 1) * 2 * (vertsPerRow - 1);
trianglesA = (int (*)[3])gmallocn(nTrianglesA * 3, sizeof(int));
k = 0;
for (i = 0; i < nRows - 1; ++i) {
for (j = 0; j < vertsPerRow - 1; ++j) {
trianglesA[k][0] = i * vertsPerRow + j;
trianglesA[k][1] = i * vertsPerRow + j+1;
trianglesA[k][2] = (i+1) * vertsPerRow + j;
++k;
trianglesA[k][0] = i * vertsPerRow + j+1;
trianglesA[k][1] = (i+1) * vertsPerRow + j;
trianglesA[k][2] = (i+1) * vertsPerRow + j+1;
++k;
}
}
}
shading = new GfxGouraudTriangleShading(typeA, verticesA, nVerticesA,
trianglesA, nTrianglesA,
funcsA, nFuncsA);
if (!shading->init(dict)) {
delete shading;
return NULL;
}
return shading;
err2:
obj1.free();
err1:
return NULL;
}
|
DoS Exec Code Overflow
| 0
|
GfxGouraudTriangleShading *GfxGouraudTriangleShading::parse(int typeA,
Dict *dict,
Stream *str) {
GfxGouraudTriangleShading *shading;
Function *funcsA[gfxColorMaxComps];
int nFuncsA;
int coordBits, compBits, flagBits, vertsPerRow, nRows;
double xMin, xMax, yMin, yMax;
double cMin[gfxColorMaxComps], cMax[gfxColorMaxComps];
double xMul, yMul;
double cMul[gfxColorMaxComps];
GfxGouraudVertex *verticesA;
int (*trianglesA)[3];
int nComps, nVerticesA, nTrianglesA, vertSize, triSize;
Guint x, y, flag;
Guint c[gfxColorMaxComps];
GfxShadingBitBuf *bitBuf;
Object obj1, obj2;
int i, j, k, state;
if (dict->lookup("BitsPerCoordinate", &obj1)->isInt()) {
coordBits = obj1.getInt();
} else {
error(-1, "Missing or invalid BitsPerCoordinate in shading dictionary");
goto err2;
}
obj1.free();
if (dict->lookup("BitsPerComponent", &obj1)->isInt()) {
compBits = obj1.getInt();
} else {
error(-1, "Missing or invalid BitsPerComponent in shading dictionary");
goto err2;
}
obj1.free();
flagBits = vertsPerRow = 0; // make gcc happy
if (typeA == 4) {
if (dict->lookup("BitsPerFlag", &obj1)->isInt()) {
flagBits = obj1.getInt();
} else {
error(-1, "Missing or invalid BitsPerFlag in shading dictionary");
goto err2;
}
obj1.free();
} else {
if (dict->lookup("VerticesPerRow", &obj1)->isInt()) {
vertsPerRow = obj1.getInt();
} else {
error(-1, "Missing or invalid VerticesPerRow in shading dictionary");
goto err2;
}
obj1.free();
}
if (dict->lookup("Decode", &obj1)->isArray() &&
obj1.arrayGetLength() >= 6) {
xMin = obj1.arrayGet(0, &obj2)->getNum();
obj2.free();
xMax = obj1.arrayGet(1, &obj2)->getNum();
obj2.free();
xMul = (xMax - xMin) / (pow(2.0, coordBits) - 1);
yMin = obj1.arrayGet(2, &obj2)->getNum();
obj2.free();
yMax = obj1.arrayGet(3, &obj2)->getNum();
obj2.free();
yMul = (yMax - yMin) / (pow(2.0, coordBits) - 1);
for (i = 0; 5 + 2*i < obj1.arrayGetLength() && i < gfxColorMaxComps; ++i) {
cMin[i] = obj1.arrayGet(4 + 2*i, &obj2)->getNum();
obj2.free();
cMax[i] = obj1.arrayGet(5 + 2*i, &obj2)->getNum();
obj2.free();
cMul[i] = (cMax[i] - cMin[i]) / (double)((1 << compBits) - 1);
}
nComps = i;
} else {
error(-1, "Missing or invalid Decode array in shading dictionary");
goto err2;
}
obj1.free();
if (!dict->lookup("Function", &obj1)->isNull()) {
if (obj1.isArray()) {
nFuncsA = obj1.arrayGetLength();
if (nFuncsA > gfxColorMaxComps) {
error(-1, "Invalid Function array in shading dictionary");
goto err1;
}
for (i = 0; i < nFuncsA; ++i) {
obj1.arrayGet(i, &obj2);
if (!(funcsA[i] = Function::parse(&obj2))) {
obj1.free();
obj2.free();
goto err1;
}
obj2.free();
}
} else {
nFuncsA = 1;
if (!(funcsA[0] = Function::parse(&obj1))) {
obj1.free();
goto err1;
}
}
} else {
nFuncsA = 0;
}
obj1.free();
nVerticesA = nTrianglesA = 0;
verticesA = NULL;
trianglesA = NULL;
vertSize = triSize = 0;
state = 0;
flag = 0; // make gcc happy
bitBuf = new GfxShadingBitBuf(str);
while (1) {
if (typeA == 4) {
if (!bitBuf->getBits(flagBits, &flag)) {
break;
}
}
if (!bitBuf->getBits(coordBits, &x) ||
!bitBuf->getBits(coordBits, &y)) {
break;
}
for (i = 0; i < nComps; ++i) {
if (!bitBuf->getBits(compBits, &c[i])) {
break;
}
}
if (i < nComps) {
break;
}
if (nVerticesA == vertSize) {
vertSize = (vertSize == 0) ? 16 : 2 * vertSize;
verticesA = (GfxGouraudVertex *)
greallocn(verticesA, vertSize, sizeof(GfxGouraudVertex));
}
verticesA[nVerticesA].x = xMin + xMul * (double)x;
verticesA[nVerticesA].y = yMin + yMul * (double)y;
for (i = 0; i < nComps; ++i) {
verticesA[nVerticesA].color.c[i] =
dblToCol(cMin[i] + cMul[i] * (double)c[i]);
}
++nVerticesA;
bitBuf->flushBits();
if (typeA == 4) {
if (state == 0 || state == 1) {
++state;
} else if (state == 2 || flag > 0) {
if (nTrianglesA == triSize) {
triSize = (triSize == 0) ? 16 : 2 * triSize;
trianglesA = (int (*)[3])
greallocn(trianglesA, triSize * 3, sizeof(int));
}
if (state == 2) {
trianglesA[nTrianglesA][0] = nVerticesA - 3;
trianglesA[nTrianglesA][1] = nVerticesA - 2;
trianglesA[nTrianglesA][2] = nVerticesA - 1;
++state;
} else if (flag == 1) {
trianglesA[nTrianglesA][0] = trianglesA[nTrianglesA - 1][1];
trianglesA[nTrianglesA][1] = trianglesA[nTrianglesA - 1][2];
trianglesA[nTrianglesA][2] = nVerticesA - 1;
} else { // flag == 2
trianglesA[nTrianglesA][0] = trianglesA[nTrianglesA - 1][0];
trianglesA[nTrianglesA][1] = trianglesA[nTrianglesA - 1][2];
trianglesA[nTrianglesA][2] = nVerticesA - 1;
}
++nTrianglesA;
} else { // state == 3 && flag == 0
state = 1;
}
}
}
delete bitBuf;
if (typeA == 5) {
nRows = nVerticesA / vertsPerRow;
nTrianglesA = (nRows - 1) * 2 * (vertsPerRow - 1);
trianglesA = (int (*)[3])gmallocn(nTrianglesA * 3, sizeof(int));
k = 0;
for (i = 0; i < nRows - 1; ++i) {
for (j = 0; j < vertsPerRow - 1; ++j) {
trianglesA[k][0] = i * vertsPerRow + j;
trianglesA[k][1] = i * vertsPerRow + j+1;
trianglesA[k][2] = (i+1) * vertsPerRow + j;
++k;
trianglesA[k][0] = i * vertsPerRow + j+1;
trianglesA[k][1] = (i+1) * vertsPerRow + j;
trianglesA[k][2] = (i+1) * vertsPerRow + j+1;
++k;
}
}
}
shading = new GfxGouraudTriangleShading(typeA, verticesA, nVerticesA,
trianglesA, nTrianglesA,
funcsA, nFuncsA);
if (!shading->init(dict)) {
delete shading;
return NULL;
}
return shading;
err2:
obj1.free();
err1:
return NULL;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
868
|
GfxPatchMeshShading *GfxPatchMeshShading::parse(int typeA, Dict *dict,
Stream *str) {
GfxPatchMeshShading *shading;
Function *funcsA[gfxColorMaxComps];
int nFuncsA;
int coordBits, compBits, flagBits;
double xMin, xMax, yMin, yMax;
double cMin[gfxColorMaxComps], cMax[gfxColorMaxComps];
double xMul, yMul;
double cMul[gfxColorMaxComps];
GfxPatch *patchesA, *p;
int nComps, nPatchesA, patchesSize, nPts, nColors;
Guint flag;
double x[16], y[16];
Guint xi, yi;
GfxColorComp c[4][gfxColorMaxComps];
Guint ci[4];
GfxShadingBitBuf *bitBuf;
Object obj1, obj2;
int i, j;
if (dict->lookup("BitsPerCoordinate", &obj1)->isInt()) {
coordBits = obj1.getInt();
} else {
error(-1, "Missing or invalid BitsPerCoordinate in shading dictionary");
goto err2;
}
obj1.free();
if (dict->lookup("BitsPerComponent", &obj1)->isInt()) {
compBits = obj1.getInt();
} else {
error(-1, "Missing or invalid BitsPerComponent in shading dictionary");
goto err2;
}
obj1.free();
if (dict->lookup("BitsPerFlag", &obj1)->isInt()) {
flagBits = obj1.getInt();
} else {
error(-1, "Missing or invalid BitsPerFlag in shading dictionary");
goto err2;
}
obj1.free();
if (dict->lookup("Decode", &obj1)->isArray() &&
obj1.arrayGetLength() >= 6) {
xMin = obj1.arrayGet(0, &obj2)->getNum();
obj2.free();
xMax = obj1.arrayGet(1, &obj2)->getNum();
obj2.free();
xMul = (xMax - xMin) / (pow(2.0, coordBits) - 1);
yMin = obj1.arrayGet(2, &obj2)->getNum();
obj2.free();
yMax = obj1.arrayGet(3, &obj2)->getNum();
obj2.free();
yMul = (yMax - yMin) / (pow(2.0, coordBits) - 1);
for (i = 0; 5 + 2*i < obj1.arrayGetLength() && i < gfxColorMaxComps; ++i) {
cMin[i] = obj1.arrayGet(4 + 2*i, &obj2)->getNum();
obj2.free();
cMax[i] = obj1.arrayGet(5 + 2*i, &obj2)->getNum();
obj2.free();
cMul[i] = (cMax[i] - cMin[i]) / (double)((1 << compBits) - 1);
}
nComps = i;
} else {
error(-1, "Missing or invalid Decode array in shading dictionary");
goto err2;
}
obj1.free();
if (!dict->lookup("Function", &obj1)->isNull()) {
if (obj1.isArray()) {
nFuncsA = obj1.arrayGetLength();
if (nFuncsA > gfxColorMaxComps) {
error(-1, "Invalid Function array in shading dictionary");
goto err1;
}
for (i = 0; i < nFuncsA; ++i) {
obj1.arrayGet(i, &obj2);
if (!(funcsA[i] = Function::parse(&obj2))) {
obj1.free();
obj2.free();
goto err1;
}
obj2.free();
}
} else {
nFuncsA = 1;
if (!(funcsA[0] = Function::parse(&obj1))) {
obj1.free();
goto err1;
}
}
} else {
nFuncsA = 0;
}
obj1.free();
nPatchesA = 0;
patchesA = NULL;
patchesSize = 0;
bitBuf = new GfxShadingBitBuf(str);
while (1) {
if (!bitBuf->getBits(flagBits, &flag)) {
break;
}
if (typeA == 6) {
switch (flag) {
case 0: nPts = 12; nColors = 4; break;
case 1:
case 2:
case 3:
default: nPts = 8; nColors = 2; break;
}
} else {
switch (flag) {
case 0: nPts = 16; nColors = 4; break;
case 1:
case 2:
case 3:
default: nPts = 12; nColors = 2; break;
}
}
for (i = 0; i < nPts; ++i) {
if (!bitBuf->getBits(coordBits, &xi) ||
!bitBuf->getBits(coordBits, &yi)) {
break;
}
x[i] = xMin + xMul * (double)xi;
y[i] = yMin + yMul * (double)yi;
}
if (i < nPts) {
break;
}
for (i = 0; i < nColors; ++i) {
for (j = 0; j < nComps; ++j) {
if (!bitBuf->getBits(compBits, &ci[j])) {
break;
}
c[i][j] = dblToCol(cMin[j] + cMul[j] * (double)ci[j]);
}
if (j < nComps) {
break;
}
}
if (i < nColors) {
break;
}
if (nPatchesA == patchesSize) {
patchesSize = (patchesSize == 0) ? 16 : 2 * patchesSize;
patchesA = (GfxPatch *)greallocn(patchesA,
patchesSize, sizeof(GfxPatch));
}
p = &patchesA[nPatchesA];
if (typeA == 6) {
switch (flag) {
case 0:
p->x[0][0] = x[0];
p->y[0][0] = y[0];
p->x[0][1] = x[1];
p->y[0][1] = y[1];
p->x[0][2] = x[2];
p->y[0][2] = y[2];
p->x[0][3] = x[3];
p->y[0][3] = y[3];
p->x[1][3] = x[4];
p->y[1][3] = y[4];
p->x[2][3] = x[5];
p->y[2][3] = y[5];
p->x[3][3] = x[6];
p->y[3][3] = y[6];
p->x[3][2] = x[7];
p->y[3][2] = y[7];
p->x[3][1] = x[8];
p->y[3][1] = y[8];
p->x[3][0] = x[9];
p->y[3][0] = y[9];
p->x[2][0] = x[10];
p->y[2][0] = y[10];
p->x[1][0] = x[11];
p->y[1][0] = y[11];
for (j = 0; j < nComps; ++j) {
p->color[0][0].c[j] = c[0][j];
p->color[0][1].c[j] = c[1][j];
p->color[1][1].c[j] = c[2][j];
p->color[1][0].c[j] = c[3][j];
}
break;
case 1:
p->x[0][0] = patchesA[nPatchesA-1].x[0][3];
p->y[0][0] = patchesA[nPatchesA-1].y[0][3];
p->x[0][1] = patchesA[nPatchesA-1].x[1][3];
p->y[0][1] = patchesA[nPatchesA-1].y[1][3];
p->x[0][2] = patchesA[nPatchesA-1].x[2][3];
p->y[0][2] = patchesA[nPatchesA-1].y[2][3];
p->x[0][3] = patchesA[nPatchesA-1].x[3][3];
p->y[0][3] = patchesA[nPatchesA-1].y[3][3];
p->x[1][3] = x[0];
p->y[1][3] = y[0];
p->x[2][3] = x[1];
p->y[2][3] = y[1];
p->x[3][3] = x[2];
p->y[3][3] = y[2];
p->x[3][2] = x[3];
p->y[3][2] = y[3];
p->x[3][1] = x[4];
p->y[3][1] = y[4];
p->x[3][0] = x[5];
p->y[3][0] = y[5];
p->x[2][0] = x[6];
p->y[2][0] = y[6];
p->x[1][0] = x[7];
p->y[1][0] = y[7];
for (j = 0; j < nComps; ++j) {
p->color[0][0].c[j] = patchesA[nPatchesA-1].color[0][1].c[j];
p->color[0][1].c[j] = patchesA[nPatchesA-1].color[1][1].c[j];
p->color[1][1].c[j] = c[0][j];
p->color[1][0].c[j] = c[1][j];
}
break;
case 2:
p->x[0][0] = patchesA[nPatchesA-1].x[3][3];
p->y[0][0] = patchesA[nPatchesA-1].y[3][3];
p->x[0][1] = patchesA[nPatchesA-1].x[3][2];
p->y[0][1] = patchesA[nPatchesA-1].y[3][2];
p->x[0][2] = patchesA[nPatchesA-1].x[3][1];
p->y[0][2] = patchesA[nPatchesA-1].y[3][1];
p->x[0][3] = patchesA[nPatchesA-1].x[3][0];
p->y[0][3] = patchesA[nPatchesA-1].y[3][0];
p->x[1][3] = x[0];
p->y[1][3] = y[0];
p->x[2][3] = x[1];
p->y[2][3] = y[1];
p->x[3][3] = x[2];
p->y[3][3] = y[2];
p->x[3][2] = x[3];
p->y[3][2] = y[3];
p->x[3][1] = x[4];
p->y[3][1] = y[4];
p->x[3][0] = x[5];
p->y[3][0] = y[5];
p->x[2][0] = x[6];
p->y[2][0] = y[6];
p->x[1][0] = x[7];
p->y[1][0] = y[7];
for (j = 0; j < nComps; ++j) {
p->color[0][0].c[j] = patchesA[nPatchesA-1].color[1][1].c[j];
p->color[0][1].c[j] = patchesA[nPatchesA-1].color[1][0].c[j];
p->color[1][1].c[j] = c[0][j];
p->color[1][0].c[j] = c[1][j];
}
break;
case 3:
p->x[0][0] = patchesA[nPatchesA-1].x[3][0];
p->y[0][0] = patchesA[nPatchesA-1].y[3][0];
p->x[0][1] = patchesA[nPatchesA-1].x[2][0];
p->y[0][1] = patchesA[nPatchesA-1].y[2][0];
p->x[0][2] = patchesA[nPatchesA-1].x[1][0];
p->y[0][2] = patchesA[nPatchesA-1].y[1][0];
p->x[0][3] = patchesA[nPatchesA-1].x[0][0];
p->y[0][3] = patchesA[nPatchesA-1].y[0][0];
p->x[1][3] = x[0];
p->y[1][3] = y[0];
p->x[2][3] = x[1];
p->y[2][3] = y[1];
p->x[3][3] = x[2];
p->y[3][3] = y[2];
p->x[3][2] = x[3];
p->y[3][2] = y[3];
p->x[3][1] = x[4];
p->y[3][1] = y[4];
p->x[3][0] = x[5];
p->y[3][0] = y[5];
p->x[2][0] = x[6];
p->y[2][0] = y[6];
p->x[1][0] = x[7];
p->y[1][0] = y[7];
for (j = 0; j < nComps; ++j) {
p->color[0][1].c[j] = patchesA[nPatchesA-1].color[1][0].c[j];
p->color[0][1].c[j] = patchesA[nPatchesA-1].color[0][0].c[j];
p->color[1][1].c[j] = c[0][j];
p->color[1][0].c[j] = c[1][j];
}
break;
}
} else {
switch (flag) {
case 0:
p->x[0][0] = x[0];
p->y[0][0] = y[0];
p->x[0][1] = x[1];
p->y[0][1] = y[1];
p->x[0][2] = x[2];
p->y[0][2] = y[2];
p->x[0][3] = x[3];
p->y[0][3] = y[3];
p->x[1][3] = x[4];
p->y[1][3] = y[4];
p->x[2][3] = x[5];
p->y[2][3] = y[5];
p->x[3][3] = x[6];
p->y[3][3] = y[6];
p->x[3][2] = x[7];
p->y[3][2] = y[7];
p->x[3][1] = x[8];
p->y[3][1] = y[8];
p->x[3][0] = x[9];
p->y[3][0] = y[9];
p->x[2][0] = x[10];
p->y[2][0] = y[10];
p->x[1][0] = x[11];
p->y[1][0] = y[11];
p->x[1][1] = x[12];
p->y[1][1] = y[12];
p->x[1][2] = x[13];
p->y[1][2] = y[13];
p->x[2][2] = x[14];
p->y[2][2] = y[14];
p->x[2][1] = x[15];
p->y[2][1] = y[15];
for (j = 0; j < nComps; ++j) {
p->color[0][0].c[j] = c[0][j];
p->color[0][1].c[j] = c[1][j];
p->color[1][1].c[j] = c[2][j];
p->color[1][0].c[j] = c[3][j];
}
break;
case 1:
p->x[0][0] = patchesA[nPatchesA-1].x[0][3];
p->y[0][0] = patchesA[nPatchesA-1].y[0][3];
p->x[0][1] = patchesA[nPatchesA-1].x[1][3];
p->y[0][1] = patchesA[nPatchesA-1].y[1][3];
p->x[0][2] = patchesA[nPatchesA-1].x[2][3];
p->y[0][2] = patchesA[nPatchesA-1].y[2][3];
p->x[0][3] = patchesA[nPatchesA-1].x[3][3];
p->y[0][3] = patchesA[nPatchesA-1].y[3][3];
p->x[1][3] = x[0];
p->y[1][3] = y[0];
p->x[2][3] = x[1];
p->y[2][3] = y[1];
p->x[3][3] = x[2];
p->y[3][3] = y[2];
p->x[3][2] = x[3];
p->y[3][2] = y[3];
p->x[3][1] = x[4];
p->y[3][1] = y[4];
p->x[3][0] = x[5];
p->y[3][0] = y[5];
p->x[2][0] = x[6];
p->y[2][0] = y[6];
p->x[1][0] = x[7];
p->y[1][0] = y[7];
p->x[1][1] = x[8];
p->y[1][1] = y[8];
p->x[1][2] = x[9];
p->y[1][2] = y[9];
p->x[2][2] = x[10];
p->y[2][2] = y[10];
p->x[2][1] = x[11];
p->y[2][1] = y[11];
for (j = 0; j < nComps; ++j) {
p->color[0][0].c[j] = patchesA[nPatchesA-1].color[0][1].c[j];
p->color[0][1].c[j] = patchesA[nPatchesA-1].color[1][1].c[j];
p->color[1][1].c[j] = c[0][j];
p->color[1][0].c[j] = c[1][j];
}
break;
case 2:
p->x[0][0] = patchesA[nPatchesA-1].x[3][3];
p->y[0][0] = patchesA[nPatchesA-1].y[3][3];
p->x[0][1] = patchesA[nPatchesA-1].x[3][2];
p->y[0][1] = patchesA[nPatchesA-1].y[3][2];
p->x[0][2] = patchesA[nPatchesA-1].x[3][1];
p->y[0][2] = patchesA[nPatchesA-1].y[3][1];
p->x[0][3] = patchesA[nPatchesA-1].x[3][0];
p->y[0][3] = patchesA[nPatchesA-1].y[3][0];
p->x[1][3] = x[0];
p->y[1][3] = y[0];
p->x[2][3] = x[1];
p->y[2][3] = y[1];
p->x[3][3] = x[2];
p->y[3][3] = y[2];
p->x[3][2] = x[3];
p->y[3][2] = y[3];
p->x[3][1] = x[4];
p->y[3][1] = y[4];
p->x[3][0] = x[5];
p->y[3][0] = y[5];
p->x[2][0] = x[6];
p->y[2][0] = y[6];
p->x[1][0] = x[7];
p->y[1][0] = y[7];
p->x[1][1] = x[8];
p->y[1][1] = y[8];
p->x[1][2] = x[9];
p->y[1][2] = y[9];
p->x[2][2] = x[10];
p->y[2][2] = y[10];
p->x[2][1] = x[11];
p->y[2][1] = y[11];
for (j = 0; j < nComps; ++j) {
p->color[0][0].c[j] = patchesA[nPatchesA-1].color[1][1].c[j];
p->color[0][1].c[j] = patchesA[nPatchesA-1].color[1][0].c[j];
p->color[1][1].c[j] = c[0][j];
p->color[1][0].c[j] = c[1][j];
}
break;
case 3:
p->x[0][0] = patchesA[nPatchesA-1].x[3][0];
p->y[0][0] = patchesA[nPatchesA-1].y[3][0];
p->x[0][1] = patchesA[nPatchesA-1].x[2][0];
p->y[0][1] = patchesA[nPatchesA-1].y[2][0];
p->x[0][2] = patchesA[nPatchesA-1].x[1][0];
p->y[0][2] = patchesA[nPatchesA-1].y[1][0];
p->x[0][3] = patchesA[nPatchesA-1].x[0][0];
p->y[0][3] = patchesA[nPatchesA-1].y[0][0];
p->x[1][3] = x[0];
p->y[1][3] = y[0];
p->x[2][3] = x[1];
p->y[2][3] = y[1];
p->x[3][3] = x[2];
p->y[3][3] = y[2];
p->x[3][2] = x[3];
p->y[3][2] = y[3];
p->x[3][1] = x[4];
p->y[3][1] = y[4];
p->x[3][0] = x[5];
p->y[3][0] = y[5];
p->x[2][0] = x[6];
p->y[2][0] = y[6];
p->x[1][0] = x[7];
p->y[1][0] = y[7];
p->x[1][1] = x[8];
p->y[1][1] = y[8];
p->x[1][2] = x[9];
p->y[1][2] = y[9];
p->x[2][2] = x[10];
p->y[2][2] = y[10];
p->x[2][1] = x[11];
p->y[2][1] = y[11];
for (j = 0; j < nComps; ++j) {
p->color[0][0].c[j] = patchesA[nPatchesA-1].color[1][0].c[j];
p->color[0][1].c[j] = patchesA[nPatchesA-1].color[0][0].c[j];
p->color[1][1].c[j] = c[0][j];
p->color[1][0].c[j] = c[1][j];
}
break;
}
}
++nPatchesA;
bitBuf->flushBits();
}
delete bitBuf;
if (typeA == 6) {
for (i = 0; i < nPatchesA; ++i) {
p = &patchesA[i];
p->x[1][1] = (-4 * p->x[0][0]
+6 * (p->x[0][1] + p->x[1][0])
-2 * (p->x[0][3] + p->x[3][0])
+3 * (p->x[3][1] + p->x[1][3])
- p->x[3][3]) / 9;
p->y[1][1] = (-4 * p->y[0][0]
+6 * (p->y[0][1] + p->y[1][0])
-2 * (p->y[0][3] + p->y[3][0])
+3 * (p->y[3][1] + p->y[1][3])
- p->y[3][3]) / 9;
p->x[1][2] = (-4 * p->x[0][3]
+6 * (p->x[0][2] + p->x[1][3])
-2 * (p->x[0][0] + p->x[3][3])
+3 * (p->x[3][2] + p->x[1][0])
- p->x[3][0]) / 9;
p->y[1][2] = (-4 * p->y[0][3]
+6 * (p->y[0][2] + p->y[1][3])
-2 * (p->y[0][0] + p->y[3][3])
+3 * (p->y[3][2] + p->y[1][0])
- p->y[3][0]) / 9;
p->x[2][1] = (-4 * p->x[3][0]
+6 * (p->x[3][1] + p->x[2][0])
-2 * (p->x[3][3] + p->x[0][0])
+3 * (p->x[0][1] + p->x[2][3])
- p->x[0][3]) / 9;
p->y[2][1] = (-4 * p->y[3][0]
+6 * (p->y[3][1] + p->y[2][0])
-2 * (p->y[3][3] + p->y[0][0])
+3 * (p->y[0][1] + p->y[2][3])
- p->y[0][3]) / 9;
p->x[2][2] = (-4 * p->x[3][3]
+6 * (p->x[3][2] + p->x[2][3])
-2 * (p->x[3][0] + p->x[0][3])
+3 * (p->x[0][2] + p->x[2][0])
- p->x[0][0]) / 9;
p->y[2][2] = (-4 * p->y[3][3]
+6 * (p->y[3][2] + p->y[2][3])
-2 * (p->y[3][0] + p->y[0][3])
+3 * (p->y[0][2] + p->y[2][0])
- p->y[0][0]) / 9;
}
}
shading = new GfxPatchMeshShading(typeA, patchesA, nPatchesA,
funcsA, nFuncsA);
if (!shading->init(dict)) {
delete shading;
return NULL;
}
return shading;
err2:
obj1.free();
err1:
return NULL;
}
|
DoS Exec Code Overflow
| 0
|
GfxPatchMeshShading *GfxPatchMeshShading::parse(int typeA, Dict *dict,
Stream *str) {
GfxPatchMeshShading *shading;
Function *funcsA[gfxColorMaxComps];
int nFuncsA;
int coordBits, compBits, flagBits;
double xMin, xMax, yMin, yMax;
double cMin[gfxColorMaxComps], cMax[gfxColorMaxComps];
double xMul, yMul;
double cMul[gfxColorMaxComps];
GfxPatch *patchesA, *p;
int nComps, nPatchesA, patchesSize, nPts, nColors;
Guint flag;
double x[16], y[16];
Guint xi, yi;
GfxColorComp c[4][gfxColorMaxComps];
Guint ci[4];
GfxShadingBitBuf *bitBuf;
Object obj1, obj2;
int i, j;
if (dict->lookup("BitsPerCoordinate", &obj1)->isInt()) {
coordBits = obj1.getInt();
} else {
error(-1, "Missing or invalid BitsPerCoordinate in shading dictionary");
goto err2;
}
obj1.free();
if (dict->lookup("BitsPerComponent", &obj1)->isInt()) {
compBits = obj1.getInt();
} else {
error(-1, "Missing or invalid BitsPerComponent in shading dictionary");
goto err2;
}
obj1.free();
if (dict->lookup("BitsPerFlag", &obj1)->isInt()) {
flagBits = obj1.getInt();
} else {
error(-1, "Missing or invalid BitsPerFlag in shading dictionary");
goto err2;
}
obj1.free();
if (dict->lookup("Decode", &obj1)->isArray() &&
obj1.arrayGetLength() >= 6) {
xMin = obj1.arrayGet(0, &obj2)->getNum();
obj2.free();
xMax = obj1.arrayGet(1, &obj2)->getNum();
obj2.free();
xMul = (xMax - xMin) / (pow(2.0, coordBits) - 1);
yMin = obj1.arrayGet(2, &obj2)->getNum();
obj2.free();
yMax = obj1.arrayGet(3, &obj2)->getNum();
obj2.free();
yMul = (yMax - yMin) / (pow(2.0, coordBits) - 1);
for (i = 0; 5 + 2*i < obj1.arrayGetLength() && i < gfxColorMaxComps; ++i) {
cMin[i] = obj1.arrayGet(4 + 2*i, &obj2)->getNum();
obj2.free();
cMax[i] = obj1.arrayGet(5 + 2*i, &obj2)->getNum();
obj2.free();
cMul[i] = (cMax[i] - cMin[i]) / (double)((1 << compBits) - 1);
}
nComps = i;
} else {
error(-1, "Missing or invalid Decode array in shading dictionary");
goto err2;
}
obj1.free();
if (!dict->lookup("Function", &obj1)->isNull()) {
if (obj1.isArray()) {
nFuncsA = obj1.arrayGetLength();
if (nFuncsA > gfxColorMaxComps) {
error(-1, "Invalid Function array in shading dictionary");
goto err1;
}
for (i = 0; i < nFuncsA; ++i) {
obj1.arrayGet(i, &obj2);
if (!(funcsA[i] = Function::parse(&obj2))) {
obj1.free();
obj2.free();
goto err1;
}
obj2.free();
}
} else {
nFuncsA = 1;
if (!(funcsA[0] = Function::parse(&obj1))) {
obj1.free();
goto err1;
}
}
} else {
nFuncsA = 0;
}
obj1.free();
nPatchesA = 0;
patchesA = NULL;
patchesSize = 0;
bitBuf = new GfxShadingBitBuf(str);
while (1) {
if (!bitBuf->getBits(flagBits, &flag)) {
break;
}
if (typeA == 6) {
switch (flag) {
case 0: nPts = 12; nColors = 4; break;
case 1:
case 2:
case 3:
default: nPts = 8; nColors = 2; break;
}
} else {
switch (flag) {
case 0: nPts = 16; nColors = 4; break;
case 1:
case 2:
case 3:
default: nPts = 12; nColors = 2; break;
}
}
for (i = 0; i < nPts; ++i) {
if (!bitBuf->getBits(coordBits, &xi) ||
!bitBuf->getBits(coordBits, &yi)) {
break;
}
x[i] = xMin + xMul * (double)xi;
y[i] = yMin + yMul * (double)yi;
}
if (i < nPts) {
break;
}
for (i = 0; i < nColors; ++i) {
for (j = 0; j < nComps; ++j) {
if (!bitBuf->getBits(compBits, &ci[j])) {
break;
}
c[i][j] = dblToCol(cMin[j] + cMul[j] * (double)ci[j]);
}
if (j < nComps) {
break;
}
}
if (i < nColors) {
break;
}
if (nPatchesA == patchesSize) {
patchesSize = (patchesSize == 0) ? 16 : 2 * patchesSize;
patchesA = (GfxPatch *)greallocn(patchesA,
patchesSize, sizeof(GfxPatch));
}
p = &patchesA[nPatchesA];
if (typeA == 6) {
switch (flag) {
case 0:
p->x[0][0] = x[0];
p->y[0][0] = y[0];
p->x[0][1] = x[1];
p->y[0][1] = y[1];
p->x[0][2] = x[2];
p->y[0][2] = y[2];
p->x[0][3] = x[3];
p->y[0][3] = y[3];
p->x[1][3] = x[4];
p->y[1][3] = y[4];
p->x[2][3] = x[5];
p->y[2][3] = y[5];
p->x[3][3] = x[6];
p->y[3][3] = y[6];
p->x[3][2] = x[7];
p->y[3][2] = y[7];
p->x[3][1] = x[8];
p->y[3][1] = y[8];
p->x[3][0] = x[9];
p->y[3][0] = y[9];
p->x[2][0] = x[10];
p->y[2][0] = y[10];
p->x[1][0] = x[11];
p->y[1][0] = y[11];
for (j = 0; j < nComps; ++j) {
p->color[0][0].c[j] = c[0][j];
p->color[0][1].c[j] = c[1][j];
p->color[1][1].c[j] = c[2][j];
p->color[1][0].c[j] = c[3][j];
}
break;
case 1:
p->x[0][0] = patchesA[nPatchesA-1].x[0][3];
p->y[0][0] = patchesA[nPatchesA-1].y[0][3];
p->x[0][1] = patchesA[nPatchesA-1].x[1][3];
p->y[0][1] = patchesA[nPatchesA-1].y[1][3];
p->x[0][2] = patchesA[nPatchesA-1].x[2][3];
p->y[0][2] = patchesA[nPatchesA-1].y[2][3];
p->x[0][3] = patchesA[nPatchesA-1].x[3][3];
p->y[0][3] = patchesA[nPatchesA-1].y[3][3];
p->x[1][3] = x[0];
p->y[1][3] = y[0];
p->x[2][3] = x[1];
p->y[2][3] = y[1];
p->x[3][3] = x[2];
p->y[3][3] = y[2];
p->x[3][2] = x[3];
p->y[3][2] = y[3];
p->x[3][1] = x[4];
p->y[3][1] = y[4];
p->x[3][0] = x[5];
p->y[3][0] = y[5];
p->x[2][0] = x[6];
p->y[2][0] = y[6];
p->x[1][0] = x[7];
p->y[1][0] = y[7];
for (j = 0; j < nComps; ++j) {
p->color[0][0].c[j] = patchesA[nPatchesA-1].color[0][1].c[j];
p->color[0][1].c[j] = patchesA[nPatchesA-1].color[1][1].c[j];
p->color[1][1].c[j] = c[0][j];
p->color[1][0].c[j] = c[1][j];
}
break;
case 2:
p->x[0][0] = patchesA[nPatchesA-1].x[3][3];
p->y[0][0] = patchesA[nPatchesA-1].y[3][3];
p->x[0][1] = patchesA[nPatchesA-1].x[3][2];
p->y[0][1] = patchesA[nPatchesA-1].y[3][2];
p->x[0][2] = patchesA[nPatchesA-1].x[3][1];
p->y[0][2] = patchesA[nPatchesA-1].y[3][1];
p->x[0][3] = patchesA[nPatchesA-1].x[3][0];
p->y[0][3] = patchesA[nPatchesA-1].y[3][0];
p->x[1][3] = x[0];
p->y[1][3] = y[0];
p->x[2][3] = x[1];
p->y[2][3] = y[1];
p->x[3][3] = x[2];
p->y[3][3] = y[2];
p->x[3][2] = x[3];
p->y[3][2] = y[3];
p->x[3][1] = x[4];
p->y[3][1] = y[4];
p->x[3][0] = x[5];
p->y[3][0] = y[5];
p->x[2][0] = x[6];
p->y[2][0] = y[6];
p->x[1][0] = x[7];
p->y[1][0] = y[7];
for (j = 0; j < nComps; ++j) {
p->color[0][0].c[j] = patchesA[nPatchesA-1].color[1][1].c[j];
p->color[0][1].c[j] = patchesA[nPatchesA-1].color[1][0].c[j];
p->color[1][1].c[j] = c[0][j];
p->color[1][0].c[j] = c[1][j];
}
break;
case 3:
p->x[0][0] = patchesA[nPatchesA-1].x[3][0];
p->y[0][0] = patchesA[nPatchesA-1].y[3][0];
p->x[0][1] = patchesA[nPatchesA-1].x[2][0];
p->y[0][1] = patchesA[nPatchesA-1].y[2][0];
p->x[0][2] = patchesA[nPatchesA-1].x[1][0];
p->y[0][2] = patchesA[nPatchesA-1].y[1][0];
p->x[0][3] = patchesA[nPatchesA-1].x[0][0];
p->y[0][3] = patchesA[nPatchesA-1].y[0][0];
p->x[1][3] = x[0];
p->y[1][3] = y[0];
p->x[2][3] = x[1];
p->y[2][3] = y[1];
p->x[3][3] = x[2];
p->y[3][3] = y[2];
p->x[3][2] = x[3];
p->y[3][2] = y[3];
p->x[3][1] = x[4];
p->y[3][1] = y[4];
p->x[3][0] = x[5];
p->y[3][0] = y[5];
p->x[2][0] = x[6];
p->y[2][0] = y[6];
p->x[1][0] = x[7];
p->y[1][0] = y[7];
for (j = 0; j < nComps; ++j) {
p->color[0][1].c[j] = patchesA[nPatchesA-1].color[1][0].c[j];
p->color[0][1].c[j] = patchesA[nPatchesA-1].color[0][0].c[j];
p->color[1][1].c[j] = c[0][j];
p->color[1][0].c[j] = c[1][j];
}
break;
}
} else {
switch (flag) {
case 0:
p->x[0][0] = x[0];
p->y[0][0] = y[0];
p->x[0][1] = x[1];
p->y[0][1] = y[1];
p->x[0][2] = x[2];
p->y[0][2] = y[2];
p->x[0][3] = x[3];
p->y[0][3] = y[3];
p->x[1][3] = x[4];
p->y[1][3] = y[4];
p->x[2][3] = x[5];
p->y[2][3] = y[5];
p->x[3][3] = x[6];
p->y[3][3] = y[6];
p->x[3][2] = x[7];
p->y[3][2] = y[7];
p->x[3][1] = x[8];
p->y[3][1] = y[8];
p->x[3][0] = x[9];
p->y[3][0] = y[9];
p->x[2][0] = x[10];
p->y[2][0] = y[10];
p->x[1][0] = x[11];
p->y[1][0] = y[11];
p->x[1][1] = x[12];
p->y[1][1] = y[12];
p->x[1][2] = x[13];
p->y[1][2] = y[13];
p->x[2][2] = x[14];
p->y[2][2] = y[14];
p->x[2][1] = x[15];
p->y[2][1] = y[15];
for (j = 0; j < nComps; ++j) {
p->color[0][0].c[j] = c[0][j];
p->color[0][1].c[j] = c[1][j];
p->color[1][1].c[j] = c[2][j];
p->color[1][0].c[j] = c[3][j];
}
break;
case 1:
p->x[0][0] = patchesA[nPatchesA-1].x[0][3];
p->y[0][0] = patchesA[nPatchesA-1].y[0][3];
p->x[0][1] = patchesA[nPatchesA-1].x[1][3];
p->y[0][1] = patchesA[nPatchesA-1].y[1][3];
p->x[0][2] = patchesA[nPatchesA-1].x[2][3];
p->y[0][2] = patchesA[nPatchesA-1].y[2][3];
p->x[0][3] = patchesA[nPatchesA-1].x[3][3];
p->y[0][3] = patchesA[nPatchesA-1].y[3][3];
p->x[1][3] = x[0];
p->y[1][3] = y[0];
p->x[2][3] = x[1];
p->y[2][3] = y[1];
p->x[3][3] = x[2];
p->y[3][3] = y[2];
p->x[3][2] = x[3];
p->y[3][2] = y[3];
p->x[3][1] = x[4];
p->y[3][1] = y[4];
p->x[3][0] = x[5];
p->y[3][0] = y[5];
p->x[2][0] = x[6];
p->y[2][0] = y[6];
p->x[1][0] = x[7];
p->y[1][0] = y[7];
p->x[1][1] = x[8];
p->y[1][1] = y[8];
p->x[1][2] = x[9];
p->y[1][2] = y[9];
p->x[2][2] = x[10];
p->y[2][2] = y[10];
p->x[2][1] = x[11];
p->y[2][1] = y[11];
for (j = 0; j < nComps; ++j) {
p->color[0][0].c[j] = patchesA[nPatchesA-1].color[0][1].c[j];
p->color[0][1].c[j] = patchesA[nPatchesA-1].color[1][1].c[j];
p->color[1][1].c[j] = c[0][j];
p->color[1][0].c[j] = c[1][j];
}
break;
case 2:
p->x[0][0] = patchesA[nPatchesA-1].x[3][3];
p->y[0][0] = patchesA[nPatchesA-1].y[3][3];
p->x[0][1] = patchesA[nPatchesA-1].x[3][2];
p->y[0][1] = patchesA[nPatchesA-1].y[3][2];
p->x[0][2] = patchesA[nPatchesA-1].x[3][1];
p->y[0][2] = patchesA[nPatchesA-1].y[3][1];
p->x[0][3] = patchesA[nPatchesA-1].x[3][0];
p->y[0][3] = patchesA[nPatchesA-1].y[3][0];
p->x[1][3] = x[0];
p->y[1][3] = y[0];
p->x[2][3] = x[1];
p->y[2][3] = y[1];
p->x[3][3] = x[2];
p->y[3][3] = y[2];
p->x[3][2] = x[3];
p->y[3][2] = y[3];
p->x[3][1] = x[4];
p->y[3][1] = y[4];
p->x[3][0] = x[5];
p->y[3][0] = y[5];
p->x[2][0] = x[6];
p->y[2][0] = y[6];
p->x[1][0] = x[7];
p->y[1][0] = y[7];
p->x[1][1] = x[8];
p->y[1][1] = y[8];
p->x[1][2] = x[9];
p->y[1][2] = y[9];
p->x[2][2] = x[10];
p->y[2][2] = y[10];
p->x[2][1] = x[11];
p->y[2][1] = y[11];
for (j = 0; j < nComps; ++j) {
p->color[0][0].c[j] = patchesA[nPatchesA-1].color[1][1].c[j];
p->color[0][1].c[j] = patchesA[nPatchesA-1].color[1][0].c[j];
p->color[1][1].c[j] = c[0][j];
p->color[1][0].c[j] = c[1][j];
}
break;
case 3:
p->x[0][0] = patchesA[nPatchesA-1].x[3][0];
p->y[0][0] = patchesA[nPatchesA-1].y[3][0];
p->x[0][1] = patchesA[nPatchesA-1].x[2][0];
p->y[0][1] = patchesA[nPatchesA-1].y[2][0];
p->x[0][2] = patchesA[nPatchesA-1].x[1][0];
p->y[0][2] = patchesA[nPatchesA-1].y[1][0];
p->x[0][3] = patchesA[nPatchesA-1].x[0][0];
p->y[0][3] = patchesA[nPatchesA-1].y[0][0];
p->x[1][3] = x[0];
p->y[1][3] = y[0];
p->x[2][3] = x[1];
p->y[2][3] = y[1];
p->x[3][3] = x[2];
p->y[3][3] = y[2];
p->x[3][2] = x[3];
p->y[3][2] = y[3];
p->x[3][1] = x[4];
p->y[3][1] = y[4];
p->x[3][0] = x[5];
p->y[3][0] = y[5];
p->x[2][0] = x[6];
p->y[2][0] = y[6];
p->x[1][0] = x[7];
p->y[1][0] = y[7];
p->x[1][1] = x[8];
p->y[1][1] = y[8];
p->x[1][2] = x[9];
p->y[1][2] = y[9];
p->x[2][2] = x[10];
p->y[2][2] = y[10];
p->x[2][1] = x[11];
p->y[2][1] = y[11];
for (j = 0; j < nComps; ++j) {
p->color[0][0].c[j] = patchesA[nPatchesA-1].color[1][0].c[j];
p->color[0][1].c[j] = patchesA[nPatchesA-1].color[0][0].c[j];
p->color[1][1].c[j] = c[0][j];
p->color[1][0].c[j] = c[1][j];
}
break;
}
}
++nPatchesA;
bitBuf->flushBits();
}
delete bitBuf;
if (typeA == 6) {
for (i = 0; i < nPatchesA; ++i) {
p = &patchesA[i];
p->x[1][1] = (-4 * p->x[0][0]
+6 * (p->x[0][1] + p->x[1][0])
-2 * (p->x[0][3] + p->x[3][0])
+3 * (p->x[3][1] + p->x[1][3])
- p->x[3][3]) / 9;
p->y[1][1] = (-4 * p->y[0][0]
+6 * (p->y[0][1] + p->y[1][0])
-2 * (p->y[0][3] + p->y[3][0])
+3 * (p->y[3][1] + p->y[1][3])
- p->y[3][3]) / 9;
p->x[1][2] = (-4 * p->x[0][3]
+6 * (p->x[0][2] + p->x[1][3])
-2 * (p->x[0][0] + p->x[3][3])
+3 * (p->x[3][2] + p->x[1][0])
- p->x[3][0]) / 9;
p->y[1][2] = (-4 * p->y[0][3]
+6 * (p->y[0][2] + p->y[1][3])
-2 * (p->y[0][0] + p->y[3][3])
+3 * (p->y[3][2] + p->y[1][0])
- p->y[3][0]) / 9;
p->x[2][1] = (-4 * p->x[3][0]
+6 * (p->x[3][1] + p->x[2][0])
-2 * (p->x[3][3] + p->x[0][0])
+3 * (p->x[0][1] + p->x[2][3])
- p->x[0][3]) / 9;
p->y[2][1] = (-4 * p->y[3][0]
+6 * (p->y[3][1] + p->y[2][0])
-2 * (p->y[3][3] + p->y[0][0])
+3 * (p->y[0][1] + p->y[2][3])
- p->y[0][3]) / 9;
p->x[2][2] = (-4 * p->x[3][3]
+6 * (p->x[3][2] + p->x[2][3])
-2 * (p->x[3][0] + p->x[0][3])
+3 * (p->x[0][2] + p->x[2][0])
- p->x[0][0]) / 9;
p->y[2][2] = (-4 * p->y[3][3]
+6 * (p->y[3][2] + p->y[2][3])
-2 * (p->y[3][0] + p->y[0][3])
+3 * (p->y[0][2] + p->y[2][0])
- p->y[0][0]) / 9;
}
}
shading = new GfxPatchMeshShading(typeA, patchesA, nPatchesA,
funcsA, nFuncsA);
if (!shading->init(dict)) {
delete shading;
return NULL;
}
return shading;
err2:
obj1.free();
err1:
return NULL;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
869
|
GBool GfxState::parseBlendMode(Object *obj, GfxBlendMode *mode) {
Object obj2;
int i, j;
if (obj->isName()) {
for (i = 0; i < nGfxBlendModeNames; ++i) {
if (!strcmp(obj->getName(), gfxBlendModeNames[i].name)) {
*mode = gfxBlendModeNames[i].mode;
return gTrue;
}
}
return gFalse;
} else if (obj->isArray()) {
for (i = 0; i < obj->arrayGetLength(); ++i) {
obj->arrayGet(i, &obj2);
if (!obj2.isName()) {
obj2.free();
return gFalse;
}
for (j = 0; j < nGfxBlendModeNames; ++j) {
if (!strcmp(obj2.getName(), gfxBlendModeNames[j].name)) {
obj2.free();
*mode = gfxBlendModeNames[j].mode;
return gTrue;
}
}
obj2.free();
}
*mode = gfxBlendNormal;
return gTrue;
} else {
return gFalse;
}
}
|
DoS Exec Code Overflow
| 0
|
GBool GfxState::parseBlendMode(Object *obj, GfxBlendMode *mode) {
Object obj2;
int i, j;
if (obj->isName()) {
for (i = 0; i < nGfxBlendModeNames; ++i) {
if (!strcmp(obj->getName(), gfxBlendModeNames[i].name)) {
*mode = gfxBlendModeNames[i].mode;
return gTrue;
}
}
return gFalse;
} else if (obj->isArray()) {
for (i = 0; i < obj->arrayGetLength(); ++i) {
obj->arrayGet(i, &obj2);
if (!obj2.isName()) {
obj2.free();
return gFalse;
}
for (j = 0; j < nGfxBlendModeNames; ++j) {
if (!strcmp(obj2.getName(), gfxBlendModeNames[j].name)) {
obj2.free();
*mode = gfxBlendModeNames[j].mode;
return gTrue;
}
}
obj2.free();
}
*mode = gfxBlendNormal;
return gTrue;
} else {
return gFalse;
}
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
870
|
GfxState *GfxState::save() {
GfxState *newState;
newState = copy();
newState->saved = this;
return newState;
}
|
DoS Exec Code Overflow
| 0
|
GfxState *GfxState::save() {
GfxState *newState;
newState = copy();
newState->saved = this;
return newState;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
871
|
void GfxState::setFillColorSpace(GfxColorSpace *colorSpace) {
if (fillColorSpace) {
delete fillColorSpace;
}
fillColorSpace = colorSpace;
}
|
DoS Exec Code Overflow
| 0
|
void GfxState::setFillColorSpace(GfxColorSpace *colorSpace) {
if (fillColorSpace) {
delete fillColorSpace;
}
fillColorSpace = colorSpace;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
872
|
void GfxState::setFillPattern(GfxPattern *pattern) {
if (fillPattern) {
delete fillPattern;
}
fillPattern = pattern;
}
|
DoS Exec Code Overflow
| 0
|
void GfxState::setFillPattern(GfxPattern *pattern) {
if (fillPattern) {
delete fillPattern;
}
fillPattern = pattern;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
873
|
void GfxState::setLineDash(double *dash, int length, double start) {
if (lineDash)
gfree(lineDash);
lineDash = dash;
lineDashLength = length;
lineDashStart = start;
}
|
DoS Exec Code Overflow
| 0
|
void GfxState::setLineDash(double *dash, int length, double start) {
if (lineDash)
gfree(lineDash);
lineDash = dash;
lineDashLength = length;
lineDashStart = start;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
874
|
void GfxState::setPath(GfxPath *pathA) {
delete path;
path = pathA;
}
|
DoS Exec Code Overflow
| 0
|
void GfxState::setPath(GfxPath *pathA) {
delete path;
path = pathA;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
875
|
void GfxState::setStrokeColorSpace(GfxColorSpace *colorSpace) {
if (strokeColorSpace) {
delete strokeColorSpace;
}
strokeColorSpace = colorSpace;
}
|
DoS Exec Code Overflow
| 0
|
void GfxState::setStrokeColorSpace(GfxColorSpace *colorSpace) {
if (strokeColorSpace) {
delete strokeColorSpace;
}
strokeColorSpace = colorSpace;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
876
|
void GfxState::setStrokePattern(GfxPattern *pattern) {
if (strokePattern) {
delete strokePattern;
}
strokePattern = pattern;
}
|
DoS Exec Code Overflow
| 0
|
void GfxState::setStrokePattern(GfxPattern *pattern) {
if (strokePattern) {
delete strokePattern;
}
strokePattern = pattern;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
877
|
void GfxState::setTransfer(Function **funcs) {
int i;
for (i = 0; i < 4; ++i) {
if (transfer[i]) {
delete transfer[i];
}
transfer[i] = funcs[i];
}
}
|
DoS Exec Code Overflow
| 0
|
void GfxState::setTransfer(Function **funcs) {
int i;
for (i = 0; i < 4; ++i) {
if (transfer[i]) {
delete transfer[i];
}
transfer[i] = funcs[i];
}
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
878
|
int GfxColorSpace::setupColorProfiles()
{
static GBool initialized = gFalse;
cmsHTRANSFORM transform;
unsigned int nChannels;
if (initialized) return 0;
initialized = gTrue;
cmsSetErrorHandler(CMSError);
if (displayProfile == NULL) {
if (displayProfileName == NULL) {
displayProfile = loadColorProfile("display.icc");
} else if (displayProfileName->getLength() > 0) {
displayProfile = loadColorProfile(displayProfileName->getCString());
}
}
RGBProfile = loadColorProfile("RGB.icc");
if (RGBProfile == NULL) {
/* use built in sRGB profile */
RGBProfile = cmsCreate_sRGBProfile();
}
if (displayProfile != NULL) {
displayPixelType = getCMSColorSpaceType(cmsGetColorSpace(displayProfile));
nChannels = getCMSNChannels(cmsGetColorSpace(displayProfile));
cmsHPROFILE XYZProfile = cmsCreateXYZProfile();
if ((transform = cmsCreateTransform(XYZProfile, TYPE_XYZ_DBL,
displayProfile,
COLORSPACE_SH(displayPixelType) |
CHANNELS_SH(nChannels) | BYTES_SH(1),
INTENT_RELATIVE_COLORIMETRIC,0)) == 0) {
error(-1, "Can't create Lab transform");
} else {
XYZ2DisplayTransform = new GfxColorTransform(transform);
}
cmsCloseProfile(XYZProfile);
}
return 0;
}
|
DoS Exec Code Overflow
| 0
|
int GfxColorSpace::setupColorProfiles()
{
static GBool initialized = gFalse;
cmsHTRANSFORM transform;
unsigned int nChannels;
if (initialized) return 0;
initialized = gTrue;
cmsSetErrorHandler(CMSError);
if (displayProfile == NULL) {
if (displayProfileName == NULL) {
displayProfile = loadColorProfile("display.icc");
} else if (displayProfileName->getLength() > 0) {
displayProfile = loadColorProfile(displayProfileName->getCString());
}
}
RGBProfile = loadColorProfile("RGB.icc");
if (RGBProfile == NULL) {
/* use built in sRGB profile */
RGBProfile = cmsCreate_sRGBProfile();
}
if (displayProfile != NULL) {
displayPixelType = getCMSColorSpaceType(cmsGetColorSpace(displayProfile));
nChannels = getCMSNChannels(cmsGetColorSpace(displayProfile));
cmsHPROFILE XYZProfile = cmsCreateXYZProfile();
if ((transform = cmsCreateTransform(XYZProfile, TYPE_XYZ_DBL,
displayProfile,
COLORSPACE_SH(displayPixelType) |
CHANNELS_SH(nChannels) | BYTES_SH(1),
INTENT_RELATIVE_COLORIMETRIC,0)) == 0) {
error(-1, "Can't create Lab transform");
} else {
XYZ2DisplayTransform = new GfxColorTransform(transform);
}
cmsCloseProfile(XYZProfile);
}
return 0;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
879
|
void GfxState::shift(double dx, double dy) {
curX += dx;
curY += dy;
}
|
DoS Exec Code Overflow
| 0
|
void GfxState::shift(double dx, double dy) {
curX += dx;
curY += dy;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
880
|
void GfxState::shiftCTM(double tx, double ty) {
ctm[4] += tx;
ctm[5] += ty;
clipXMin += tx;
clipYMin += ty;
clipXMax += tx;
clipYMax += ty;
}
|
DoS Exec Code Overflow
| 0
|
void GfxState::shiftCTM(double tx, double ty) {
ctm[4] += tx;
ctm[5] += ty;
clipXMin += tx;
clipYMin += ty;
clipXMax += tx;
clipYMax += ty;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
881
|
void Matrix::transform(double x, double y, double *tx, double *ty)
{
double temp_x, temp_y;
temp_x = m[0] * x + m[2] * y + m[4];
temp_y = m[1] * x + m[3] * y + m[5];
*tx = temp_x;
*ty = temp_y;
}
|
DoS Exec Code Overflow
| 0
|
void Matrix::transform(double x, double y, double *tx, double *ty)
{
double temp_x, temp_y;
temp_x = m[0] * x + m[2] * y + m[4];
temp_y = m[1] * x + m[3] * y + m[5];
*tx = temp_x;
*ty = temp_y;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
882
|
double GfxState::transformWidth(double w) {
double x, y;
x = ctm[0] + ctm[2];
y = ctm[1] + ctm[3];
return w * sqrt(0.5 * (x * x + y * y));
}
|
DoS Exec Code Overflow
| 0
|
double GfxState::transformWidth(double w) {
double x, y;
x = ctm[0] + ctm[2];
y = ctm[1] + ctm[3];
return w * sqrt(0.5 * (x * x + y * y));
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
883
|
GfxAxialShading::~GfxAxialShading() {
int i;
for (i = 0; i < nFuncs; ++i) {
delete funcs[i];
}
}
|
DoS Exec Code Overflow
| 0
|
GfxAxialShading::~GfxAxialShading() {
int i;
for (i = 0; i < nFuncs; ++i) {
delete funcs[i];
}
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
884
|
GfxCalRGBColorSpace::~GfxCalRGBColorSpace() {
}
|
DoS Exec Code Overflow
| 0
|
GfxCalRGBColorSpace::~GfxCalRGBColorSpace() {
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
885
|
GfxDeviceCMYKColorSpace::~GfxDeviceCMYKColorSpace() {
}
|
DoS Exec Code Overflow
| 0
|
GfxDeviceCMYKColorSpace::~GfxDeviceCMYKColorSpace() {
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
886
|
GfxDeviceNColorSpace::~GfxDeviceNColorSpace() {
int i;
for (i = 0; i < nComps; ++i) {
delete names[i];
}
delete alt;
delete func;
}
|
DoS Exec Code Overflow
| 0
|
GfxDeviceNColorSpace::~GfxDeviceNColorSpace() {
int i;
for (i = 0; i < nComps; ++i) {
delete names[i];
}
delete alt;
delete func;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
887
|
GfxDeviceRGBColorSpace::~GfxDeviceRGBColorSpace() {
}
|
DoS Exec Code Overflow
| 0
|
GfxDeviceRGBColorSpace::~GfxDeviceRGBColorSpace() {
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
888
|
GfxFunctionShading::~GfxFunctionShading() {
int i;
for (i = 0; i < nFuncs; ++i) {
delete funcs[i];
}
}
|
DoS Exec Code Overflow
| 0
|
GfxFunctionShading::~GfxFunctionShading() {
int i;
for (i = 0; i < nFuncs; ++i) {
delete funcs[i];
}
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
889
|
GfxGouraudTriangleShading::~GfxGouraudTriangleShading() {
int i;
gfree(vertices);
gfree(triangles);
for (i = 0; i < nFuncs; ++i) {
delete funcs[i];
}
}
|
DoS Exec Code Overflow
| 0
|
GfxGouraudTriangleShading::~GfxGouraudTriangleShading() {
int i;
gfree(vertices);
gfree(triangles);
for (i = 0; i < nFuncs; ++i) {
delete funcs[i];
}
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
890
|
GfxICCBasedColorSpace::~GfxICCBasedColorSpace() {
delete alt;
#ifdef USE_CMS
if (transform != NULL) {
if (transform->unref() == 0) delete transform;
}
if (lineTransform != NULL) {
if (lineTransform->unref() == 0) delete lineTransform;
}
#endif
}
|
DoS Exec Code Overflow
| 0
|
GfxICCBasedColorSpace::~GfxICCBasedColorSpace() {
delete alt;
#ifdef USE_CMS
if (transform != NULL) {
if (transform->unref() == 0) delete transform;
}
if (lineTransform != NULL) {
if (lineTransform->unref() == 0) delete lineTransform;
}
#endif
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
891
|
GfxImageColorMap::~GfxImageColorMap() {
int i;
delete colorSpace;
for (i = 0; i < gfxColorMaxComps; ++i) {
gfree(lookup[i]);
}
gfree(byte_lookup);
}
|
DoS Exec Code Overflow
| 0
|
GfxImageColorMap::~GfxImageColorMap() {
int i;
delete colorSpace;
for (i = 0; i < gfxColorMaxComps; ++i) {
gfree(lookup[i]);
}
gfree(byte_lookup);
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
892
|
GfxIndexedColorSpace::~GfxIndexedColorSpace() {
delete base;
gfree(lookup);
}
|
DoS Exec Code Overflow
| 0
|
GfxIndexedColorSpace::~GfxIndexedColorSpace() {
delete base;
gfree(lookup);
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
893
|
GfxLabColorSpace::~GfxLabColorSpace() {
}
|
DoS Exec Code Overflow
| 0
|
GfxLabColorSpace::~GfxLabColorSpace() {
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
894
|
GfxPath::~GfxPath() {
int i;
for (i = 0; i < n; ++i)
delete subpaths[i];
gfree(subpaths);
}
|
DoS Exec Code Overflow
| 0
|
GfxPath::~GfxPath() {
int i;
for (i = 0; i < n; ++i)
delete subpaths[i];
gfree(subpaths);
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
895
|
GfxPattern::~GfxPattern() {
}
|
DoS Exec Code Overflow
| 0
|
GfxPattern::~GfxPattern() {
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
896
|
GfxPatternColorSpace::~GfxPatternColorSpace() {
if (under) {
delete under;
}
}
|
DoS Exec Code Overflow
| 0
|
GfxPatternColorSpace::~GfxPatternColorSpace() {
if (under) {
delete under;
}
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
897
|
GfxRadialShading::~GfxRadialShading() {
int i;
for (i = 0; i < nFuncs; ++i) {
delete funcs[i];
}
}
|
DoS Exec Code Overflow
| 0
|
GfxRadialShading::~GfxRadialShading() {
int i;
for (i = 0; i < nFuncs; ++i) {
delete funcs[i];
}
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
898
|
GfxSeparationColorSpace::~GfxSeparationColorSpace() {
delete name;
delete alt;
delete func;
}
|
DoS Exec Code Overflow
| 0
|
GfxSeparationColorSpace::~GfxSeparationColorSpace() {
delete name;
delete alt;
delete func;
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
899
|
GfxShading::~GfxShading() {
if (colorSpace) {
delete colorSpace;
}
}
|
DoS Exec Code Overflow
| 0
|
GfxShading::~GfxShading() {
if (colorSpace) {
delete colorSpace;
}
}
|
@@ -1849,7 +1849,7 @@ void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length)
int i, j, n;
n = base->getNComps();
- line = (Guchar *) gmalloc (length * n);
+ line = (Guchar *) gmallocn (length, n);
for (i = 0; i < length; i++)
for (j = 0; j < n; j++)
line[i * n + j] = lookup[in[i] * n + j];
@@ -4072,7 +4072,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
nComps2 = colorSpace2->getNComps();
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
- byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2);
+ byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2);
for (k = 0; k < nComps2; ++k) {
lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
sizeof(GfxColorComp));
@@ -4220,7 +4220,7 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
@@ -4250,7 +4250,7 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
- tmp_line = (Guchar *) gmalloc (length * nComps2);
+ tmp_line = (Guchar *) gmallocn (length, nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j];
|
CWE-189
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.