mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-09-19 02:37:56 +08:00
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:
@@ -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);
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user