handle infinity symbol encountered in edge-case files

This commit is contained in:
Eliot Jones 2022-07-02 18:09:11 -04:00
parent f2188729a3
commit 3cd81297c1

View File

@ -94,7 +94,7 @@
throw new InvalidOperationException($"Failed to read expected buffer length {gap} on page {pageNumber} " +
$"when reading inline image at offset in content: {lastEndImageOffset.Value}.");
}
// Replace the last end image operator with one containing the full set of data.
graphicsStateOperations.Remove(lastEndImage);
graphicsStateOperations.Add(new EndInlineImage(lastEndImage.ImageData.Concat(missingData).ToArray()));
@ -142,6 +142,13 @@
graphicsStateOperations.Add(newEndInlineImage);
lastEndImageOffset = scanner.CurrentPosition - 3;
}
else if (op.Data == "inf")
{
// Value representing infinity in broken file from #467.
// Treat as zero.
precedingTokens.Add(NumericToken.Zero);
continue;
}
else
{
log.Warn($"Operator which was not understood encountered. Values was {op.Data}. Ignoring.");