mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
Ensure that Mesh /Shadings have non-zero width/height (issue 17848)
This commit is contained in:
parent
55db43966e
commit
07a8836ab2
5 changed files with 51 additions and 14 deletions
|
@ -956,13 +956,20 @@ class MeshShading extends BaseShading {
|
|||
}
|
||||
|
||||
getIR() {
|
||||
const { bounds } = this;
|
||||
// Ensure that the shading has non-zero width and height, to prevent errors
|
||||
// in `pattern_helper.js` (fixes issue17848.pdf).
|
||||
if (bounds[2] - bounds[0] === 0 || bounds[3] - bounds[1] === 0) {
|
||||
throw new FormatError(`Invalid MeshShading bounds: [${bounds}].`);
|
||||
}
|
||||
|
||||
return [
|
||||
"Mesh",
|
||||
this.shadingType,
|
||||
this.coords,
|
||||
this.colors,
|
||||
this.figures,
|
||||
this.bounds,
|
||||
bounds,
|
||||
this.bbox,
|
||||
this.background,
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue