Fallback on gray colorspace when there are no colorspace and no name in the scn/SCN arguments

It fixes #18894.
This commit is contained in:
Calixte Denizet 2024-10-13 16:00:36 +02:00
parent c3af34271e
commit e7ab8cd8c1
4 changed files with 19 additions and 0 deletions

View File

@ -2079,6 +2079,11 @@ class PartialEvaluator {
case OPS.setFillColorN: case OPS.setFillColorN:
cs = stateManager.state.patternFillColorSpace; cs = stateManager.state.patternFillColorSpace;
if (!cs) { if (!cs) {
if (isNumberArray(args, null)) {
args = ColorSpace.singletons.gray.getRgb(args, 0);
fn = OPS.setFillRGBColor;
break;
}
args = []; args = [];
fn = OPS.setFillTransparent; fn = OPS.setFillTransparent;
break; break;
@ -2106,6 +2111,11 @@ class PartialEvaluator {
case OPS.setStrokeColorN: case OPS.setStrokeColorN:
cs = stateManager.state.patternStrokeColorSpace; cs = stateManager.state.patternStrokeColorSpace;
if (!cs) { if (!cs) {
if (isNumberArray(args, null)) {
args = ColorSpace.singletons.gray.getRgb(args, 0);
fn = OPS.setStrokeRGBColor;
break;
}
args = []; args = [];
fn = OPS.setStrokeTransparent; fn = OPS.setStrokeTransparent;
break; break;

View File

@ -675,3 +675,4 @@
!stamps.pdf !stamps.pdf
!issue15096.pdf !issue15096.pdf
!issue18036.pdf !issue18036.pdf
!issue18894.pdf

BIN
test/pdfs/issue18894.pdf Executable file

Binary file not shown.

View File

@ -10692,5 +10692,13 @@
"rounds": 1, "rounds": 1,
"type": "eq", "type": "eq",
"annotations": true "annotations": true
},
{
"id": "issue18894",
"file": "pdfs/issue18894.pdf",
"md5": "5cd744bf8c0800e93c22ed92d1c162f4",
"rounds": 1,
"type": "eq",
"talos": false
} }
] ]