1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

Ensure that TilingPatterns have valid (non-zero) /BBox arrays (issue 8330)

Fixes 8330.
This commit is contained in:
Jonas Jenwald 2017-05-24 12:12:14 +02:00
parent 9342054502
commit e589834f13
5 changed files with 45 additions and 20 deletions

View file

@ -795,12 +795,18 @@ Shadings.Dummy = (function DummyClosure() {
})();
function getTilingPatternIR(operatorList, dict, args) {
var matrix = dict.getArray('Matrix');
var bbox = dict.getArray('BBox');
var xstep = dict.get('XStep');
var ystep = dict.get('YStep');
var paintType = dict.get('PaintType');
var tilingType = dict.get('TilingType');
let matrix = dict.getArray('Matrix');
let bbox = Util.normalizeRect(dict.getArray('BBox'));
let xstep = dict.get('XStep');
let ystep = dict.get('YStep');
let paintType = dict.get('PaintType');
let tilingType = dict.get('TilingType');
// Ensure that the pattern has a non-zero width and height, to prevent errors
// in `pattern_helper.js` (fixes issue8330.pdf).
if ((bbox[2] - bbox[0]) === 0 || (bbox[3] - bbox[1]) === 0) {
throw new Error(`getTilingPatternIR - invalid /BBox array: [${bbox}].`);
}
return [
'TilingPattern', args, operatorList, matrix, bbox, xstep, ystep,