skip cross references outside file

if the previous cross-reference location points to an offset outside the file size we skip it.

also makes cid font factory more resilient by skipping missing descriptors.
This commit is contained in:
Eliot Jones
2020-01-07 12:37:41 +00:00
parent 5114b2da2c
commit 903d71a93d
2 changed files with 14 additions and 2 deletions

View File

@@ -52,6 +52,11 @@
{
log.Debug($"Reading cross reference table or stream at {previousCrossReferenceLocation}.");
if (previousCrossReferenceLocation >= bytes.Length)
{
break;
}
// seek to xref table
tokenScanner.Seek(previousCrossReferenceLocation);

View File

@@ -84,9 +84,16 @@
return false;
}
var descriptor = DirectObjectFinder.Get<DictionaryToken>(baseValue, pdfScanner);
try
{
var descriptor = DirectObjectFinder.Get<DictionaryToken>(baseValue, pdfScanner);
descriptorDictionary = descriptor;
descriptorDictionary = descriptor;
}
catch
{
return false;
}
return true;
}