mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-09-21 04:17:57 +08:00
handle newlines before inline images and support larger data streams in brute force search
This commit is contained in:
@@ -49,6 +49,10 @@
|
||||
bool endobjFound = false;
|
||||
do
|
||||
{
|
||||
if (loopProtection >= 700_000)
|
||||
{
|
||||
|
||||
}
|
||||
if (loopProtection > 1_000_000)
|
||||
{
|
||||
throw new PdfDocumentFormatException("Failed to brute-force search the file due to an infinite loop.");
|
||||
@@ -92,6 +96,7 @@
|
||||
{
|
||||
bytes.MoveNext();
|
||||
currentOffset++;
|
||||
loopProtection = 0;
|
||||
}
|
||||
|
||||
continue;
|
||||
|
@@ -210,7 +210,7 @@
|
||||
{
|
||||
// The ID operator should be followed by a single white-space character, and the next character is interpreted
|
||||
// as the first byte of image data.
|
||||
if (inputBytes.CurrentByte != ' ')
|
||||
if (!ReadHelper.IsWhitespace(inputBytes.CurrentByte))
|
||||
{
|
||||
throw new PdfDocumentFormatException($"No whitespace character following the image data (ID) operator. Position: {inputBytes.CurrentOffset}.");
|
||||
}
|
||||
|
Reference in New Issue
Block a user