Diffstat (limited to 'noncore/unsupported/qpdf/xpdf/Function.cc') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/unsupported/qpdf/xpdf/Function.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/noncore/unsupported/qpdf/xpdf/Function.cc b/noncore/unsupported/qpdf/xpdf/Function.cc index 815cc89..ebf3718 100644 --- a/noncore/unsupported/qpdf/xpdf/Function.cc +++ b/noncore/unsupported/qpdf/xpdf/Function.cc | |||
@@ -2,7 +2,7 @@ | |||
2 | // | 2 | // |
3 | // Function.cc | 3 | // Function.cc |
4 | // | 4 | // |
5 | // Copyright 2001 Derek B. Noonburg | 5 | // Copyright 2001-2002 Glyph & Cog, LLC |
6 | // | 6 | // |
7 | //======================================================================== | 7 | //======================================================================== |
8 | 8 | ||
@@ -415,7 +415,6 @@ ExponentialFunction::ExponentialFunction(Object *funcObj, Dict *dict) { | |||
415 | int i; | 415 | int i; |
416 | 416 | ||
417 | ok = gFalse; | 417 | ok = gFalse; |
418 | hasN = gFalse; | ||
419 | 418 | ||
420 | //----- initialize the generic stuff | 419 | //----- initialize the generic stuff |
421 | if (!init(dict)) { | 420 | if (!init(dict)) { |
@@ -425,6 +424,7 @@ ExponentialFunction::ExponentialFunction(Object *funcObj, Dict *dict) { | |||
425 | error(-1, "Exponential function with more than one input"); | 424 | error(-1, "Exponential function with more than one input"); |
426 | goto err1; | 425 | goto err1; |
427 | } | 426 | } |
427 | hasN = hasRange; | ||
428 | 428 | ||
429 | //----- default values | 429 | //----- default values |
430 | for (i = 0; i < funcMaxOutputs; ++i) { | 430 | for (i = 0; i < funcMaxOutputs; ++i) { |
@@ -436,6 +436,7 @@ ExponentialFunction::ExponentialFunction(Object *funcObj, Dict *dict) { | |||
436 | if (dict->lookup("C0", &obj1)->isArray()) { | 436 | if (dict->lookup("C0", &obj1)->isArray()) { |
437 | if (!hasN) { | 437 | if (!hasN) { |
438 | n = obj1.arrayGetLength(); | 438 | n = obj1.arrayGetLength(); |
439 | hasN = gTrue; | ||
439 | } else if (obj1.arrayGetLength() != n) { | 440 | } else if (obj1.arrayGetLength() != n) { |
440 | error(-1, "Function's C0 array is wrong length"); | 441 | error(-1, "Function's C0 array is wrong length"); |
441 | goto err2; | 442 | goto err2; |
@@ -456,6 +457,7 @@ ExponentialFunction::ExponentialFunction(Object *funcObj, Dict *dict) { | |||
456 | if (dict->lookup("C1", &obj1)->isArray()) { | 457 | if (dict->lookup("C1", &obj1)->isArray()) { |
457 | if (!hasN) { | 458 | if (!hasN) { |
458 | n = obj1.arrayGetLength(); | 459 | n = obj1.arrayGetLength(); |
460 | hasN = gTrue; | ||
459 | } else if (obj1.arrayGetLength() != n) { | 461 | } else if (obj1.arrayGetLength() != n) { |
460 | error(-1, "Function's C1 array is wrong length"); | 462 | error(-1, "Function's C1 array is wrong length"); |
461 | goto err2; | 463 | goto err2; |
@@ -480,6 +482,13 @@ ExponentialFunction::ExponentialFunction(Object *funcObj, Dict *dict) { | |||
480 | e = obj1.getNum(); | 482 | e = obj1.getNum(); |
481 | obj1.free(); | 483 | obj1.free(); |
482 | 484 | ||
485 | // this isn't supposed to happen, but I've run into (broken) PDF | ||
486 | // files where it does | ||
487 | if (!hasN) { | ||
488 | error(-1, "Exponential function does not define number of output values"); | ||
489 | n = 1; | ||
490 | } | ||
491 | |||
483 | ok = gTrue; | 492 | ok = gTrue; |
484 | return; | 493 | return; |
485 | 494 | ||