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 pageLabels = new Array(this.numPages);
|
||||||
var style = null;
|
var style = null;
|
||||||
var prefix = '';
|
var prefix = '';
|
||||||
var start = 1;
|
|
||||||
|
|
||||||
var numberTree = new NumberTree(obj, this.xref);
|
var numberTree = new NumberTree(obj, this.xref);
|
||||||
var nums = numberTree.getAll();
|
var nums = numberTree.getAll();
|
||||||
@ -300,15 +299,16 @@ var Catalog = (function CatalogClosure() {
|
|||||||
|
|
||||||
var s = labelDict.get('S');
|
var s = labelDict.get('S');
|
||||||
assert(!s || isName(s), 'Invalid style in PageLabel dictionary.');
|
assert(!s || isName(s), 'Invalid style in PageLabel dictionary.');
|
||||||
style = (s ? s.name : null);
|
style = s ? s.name : null;
|
||||||
|
|
||||||
var p = labelDict.get('P') || '';
|
var p = labelDict.get('P');
|
||||||
assert(isString(p), 'Invalid prefix in PageLabel dictionary.');
|
assert(!p || isString(p), 'Invalid prefix in PageLabel dictionary.');
|
||||||
prefix = stringToPDFString(p);
|
prefix = p ? stringToPDFString(p) : '';
|
||||||
|
|
||||||
start = labelDict.get('St') || 1;
|
var st = labelDict.get('St');
|
||||||
assert(isInt(start), 'Invalid start in PageLabel dictionary.');
|
assert(!st || (isInt(st) && st >= 1),
|
||||||
currentIndex = start;
|
'Invalid start in PageLabel dictionary.');
|
||||||
|
currentIndex = st || 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (style) {
|
switch (style) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user