Commit 5d394eef authored by Dirk Mueller's avatar Dirk Mueller
Browse files

fix xpdf buffer overflow

svn path=/trunk/kdegraphics/kpdf/; revision=372724
parent 700779e8
......@@ -2654,7 +2654,9 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) {
haveMask = gFalse;
dict->lookup("Mask", &maskObj);
if (maskObj.isArray()) {
for (i = 0; i < maskObj.arrayGetLength(); ++i) {
for (i = 0;
i < maskObj.arrayGetLength() && i < 2*gfxColorMaxComps;
++i) {
maskObj.arrayGet(i, &obj1);
maskColors[i] = obj1.getInt();
obj1.free();
......
......@@ -708,6 +708,11 @@ GfxColorSpace *GfxICCBasedColorSpace::parse(Array *arr) {
}
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) {
......@@ -1054,7 +1059,7 @@ GfxColorSpace *GfxDeviceNColorSpace::parse(Array *arr) {
}
nCompsA = obj1.arrayGetLength();
if (nCompsA > gfxColorMaxComps) {
error(-1, "DeviceN color space with more than %d > %d components",
error(-1, "DeviceN color space with too many (%d > %d) components",
nCompsA, gfxColorMaxComps);
nCompsA = gfxColorMaxComps;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment