Add a bit more validation to Catalog_readPageLabels
, to ensure that the Page Labels are well formed
This commit is contained in:
parent
2d8d8b5e53
commit
0844a72b4d
@ -283,7 +283,6 @@ var Catalog = (function CatalogClosure() {
|
||||
var pageLabels = new Array(this.numPages);
|
||||
var style = null;
|
||||
var prefix = '';
|
||||
var start = 1;
|
||||
|
||||
var numberTree = new NumberTree(obj, this.xref);
|
||||
var nums = numberTree.getAll();
|
||||
@ -300,15 +299,16 @@ var Catalog = (function CatalogClosure() {
|
||||
|
||||
var s = labelDict.get('S');
|
||||
assert(!s || isName(s), 'Invalid style in PageLabel dictionary.');
|
||||
style = (s ? s.name : null);
|
||||
style = s ? s.name : null;
|
||||
|
||||
var p = labelDict.get('P') || '';
|
||||
assert(isString(p), 'Invalid prefix in PageLabel dictionary.');
|
||||
prefix = stringToPDFString(p);
|
||||
var p = labelDict.get('P');
|
||||
assert(!p || isString(p), 'Invalid prefix in PageLabel dictionary.');
|
||||
prefix = p ? stringToPDFString(p) : '';
|
||||
|
||||
start = labelDict.get('St') || 1;
|
||||
assert(isInt(start), 'Invalid start in PageLabel dictionary.');
|
||||
currentIndex = start;
|
||||
var st = labelDict.get('St');
|
||||
assert(!st || (isInt(st) && st >= 1),
|
||||
'Invalid start in PageLabel dictionary.');
|
||||
currentIndex = st || 1;
|
||||
}
|
||||
|
||||
switch (style) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user