progress
This commit is contained in:
parent
8068ff242d
commit
4375bd2219
18
src/obj.js
18
src/obj.js
@ -303,32 +303,32 @@ var XRef = (function XRefClosure() {
|
|||||||
var count = parser.getObj();
|
var count = parser.getObj();
|
||||||
|
|
||||||
if (!isInt(first) || !isInt(count))
|
if (!isInt(first) || !isInt(count))
|
||||||
error('Invalid XRef table');
|
error('Invalid XRef table: wrong types in subsection header');
|
||||||
|
|
||||||
// Inner loop is over objects themselves
|
// Inner loop is over objects themselves
|
||||||
for (var i = first; i < first + count; ++i) {
|
for (var i = 0; i < count; i++) {
|
||||||
var entry = {};
|
var entry = {};
|
||||||
entry.offset = parser.getObj();
|
entry.offset = parser.getObj();
|
||||||
entry.gen = parser.getObj();
|
entry.gen = parser.getObj();
|
||||||
var type = parser.getObj();
|
var type = parser.getObj();
|
||||||
|
|
||||||
if (type === 'f')
|
if (isCmd(type, 'f'))
|
||||||
entry.free = true;
|
entry.free = true;
|
||||||
else if (type === 'n')
|
else if (isCmd(type, 'n'))
|
||||||
entry.uncompressed = true;
|
entry.uncompressed = true;
|
||||||
|
|
||||||
// Validate entry obj
|
// Validate entry obj
|
||||||
if ( !isInt(entry.offset) || !isInt(entry.gen) ||
|
if ( !isInt(entry.offset) || !isInt(entry.gen) ||
|
||||||
!(('free' in entry) || ('uncompressed' in entry)) ) {
|
!(entry.free || entry.uncompressed) ) {
|
||||||
error('Invalid XRef table: ' + first + ', ' + count);
|
error('Invalid XRef table: ' + first + ', ' + count);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.entries[i])
|
if (!this.entries[i + first])
|
||||||
this.entries[i] = entry;
|
this.entries[i + first] = entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No objects added?
|
// No objects added?
|
||||||
if (i - first <= 0)
|
if (!(i > 0))
|
||||||
error('Invalid XRef table: ' + first + ', ' + count);
|
error('Invalid XRef table: ' + first + ', ' + count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,7 +339,7 @@ var XRef = (function XRefClosure() {
|
|||||||
|
|
||||||
// get the 'Prev' pointer
|
// get the 'Prev' pointer
|
||||||
var prev;
|
var prev;
|
||||||
obj = dict.get('Prev');
|
var obj = dict.get('Prev');
|
||||||
if (isInt(obj)) {
|
if (isInt(obj)) {
|
||||||
prev = obj;
|
prev = obj;
|
||||||
} else if (isRef(obj)) {
|
} else if (isRef(obj)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user