File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2206,6 +2206,22 @@ class PartialEvaluator {
22062206 args [ 0 ] = Math . abs ( thickness ) ;
22072207 break ;
22082208 }
2209+ case OPS . setDash : {
2210+ const dashPhase = args [ 1 ] ;
2211+ if ( typeof dashPhase !== "number" ) {
2212+ warn ( `Invalid setDash: ${ dashPhase } ` ) ;
2213+ continue ;
2214+ }
2215+ const dashArray = args [ 0 ] ;
2216+ if ( ! Array . isArray ( dashArray ) ) {
2217+ warn ( `Invalid setDash: ${ dashArray } ` ) ;
2218+ continue ;
2219+ }
2220+ if ( dashArray . some ( x => typeof x !== "number" ) ) {
2221+ args [ 0 ] = dashArray . filter ( x => typeof x === "number" ) ;
2222+ }
2223+ break ;
2224+ }
22092225 case OPS . moveTo :
22102226 case OPS . lineTo :
22112227 case OPS . curveTo :
Original file line number Diff line number Diff line change @@ -357,6 +357,18 @@ describe("evaluator", function () {
357357 expect ( result . argsArray ) . toEqual ( [ ] ) ;
358358 expect ( result . fnArray ) . toEqual ( [ ] ) ;
359359 } ) ;
360+
361+ it ( "should handle invalid dash stuff" , async function ( ) {
362+ const stream = new StringStream ( "[ none ] 0 d" ) ;
363+ const result = await runOperatorListCheck (
364+ partialEvaluator ,
365+ stream ,
366+ new ResourcesMock ( )
367+ ) ;
368+ expect ( result . argsArray [ 0 ] [ 0 ] ) . toEqual ( [ ] ) ;
369+ expect ( result . argsArray [ 0 ] [ 1 ] ) . toEqual ( 0 ) ;
370+ expect ( result . fnArray [ 0 ] ) . toEqual ( OPS . setDash ) ;
371+ } ) ;
360372 } ) ;
361373
362374 describe ( "thread control" , function ( ) {
You can’t perform that action at this time.
0 commit comments