mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-15 19:54:52 +08:00
cross reference offset is in the xref table we ignore the error
previously we checked the offset was not inside the table (correct thing to check), however this is only a special case of the more general issue (cross reference offsets are wrong). we move handling for this into the pdf token scanner. if we attempt to read an object at an offset and it fails we brute force the entire file to find correct offsets. we also needed to add handling to make sure we don't attempt to use stream length tokens if we're brute-forcing since we can't look up indirect references for length.
This commit is contained in:
@@ -227,7 +227,7 @@ trailer
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EntryPointingAtOffsetInTableThrows()
|
||||
public void EntryPointingAtOffsetInTableDoesNotThrow()
|
||||
{
|
||||
var input = GetReader(@"xref
|
||||
0 2
|
||||
@@ -236,9 +236,10 @@ trailer
|
||||
trailer
|
||||
<<>>");
|
||||
|
||||
Action action = () => parser.Parse(input, 0, false);
|
||||
var result = parser.Parse(input, 0, false);
|
||||
|
||||
Assert.Throws<PdfDocumentFormatException>(action);
|
||||
var offset = Assert.Single(result.ObjectOffsets);
|
||||
Assert.Equal(10, offset.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
Reference in New Issue
Block a user