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

Limit image size to 1024*1024 for b2g.

This commit is contained in:
Brendan Dahl 2013-07-10 09:52:37 -07:00
parent d71948038f
commit bcc085ec52
5 changed files with 26 additions and 2 deletions

View file

@ -234,6 +234,11 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
var w = dict.get('Width', 'W');
var h = dict.get('Height', 'H');
if (PDFJS.maxImageSize !== -1 && w * h > PDFJS.maxImageSize) {
warn('Image exceeded maximum allowed size and was removed.');
return null;
}
var dependencies = {};
var retData = {
dependencies: dependencies
@ -706,6 +711,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
} else if ('Image' == type.name) {
var data = self.buildPaintImageXObject(
resources, xobj, false);
if (!data) {
args = [];
continue;
}
Util.extendObj(dependencies, data.dependencies);
self.insertDependencies(queue, data.dependencies);
fn = data.fn;
@ -720,6 +729,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
} else if (cmd == 'EI') {
var data = self.buildPaintImageXObject(
resources, args[0], true);
if (!data) {
args = [];
continue;
}
Util.extendObj(dependencies, data.dependencies);
self.insertDependencies(queue, data.dependencies);
fn = data.fn;