mirror of
https://github.com/UglyToad/PdfPig.git
synced 2026-03-10 00:23:29 +08:00
Check for index out of range in GlyphDataTable.ReadFlags() and fix #1199
This commit is contained in:
@@ -338,7 +338,15 @@
|
||||
|
||||
for (int j = 0; j < numberOfRepeats; j++)
|
||||
{
|
||||
result[i + j + 1] = result[i];
|
||||
int p = i + j + 1;
|
||||
if (p >= result.Length)
|
||||
{
|
||||
// Unsure why this happens but fixes #1199
|
||||
// TODO - Is there a better fix?
|
||||
break;
|
||||
}
|
||||
|
||||
result[p] = result[i];
|
||||
}
|
||||
|
||||
i += numberOfRepeats;
|
||||
|
||||
Binary file not shown.
@@ -8,6 +8,21 @@
|
||||
|
||||
public class GithubIssuesTests
|
||||
{
|
||||
[Fact]
|
||||
public void Issue1199()
|
||||
{
|
||||
var path = IntegrationHelpers.GetDocumentPath("TrueTypeTablesGlyphDataTableReadGlyphsError.pdf");
|
||||
|
||||
using (var document = PdfDocument.Open(path, new ParsingOptions() { UseLenientParsing = true }))
|
||||
{
|
||||
for (int p = 1; p <= document.NumberOfPages; p++)
|
||||
{
|
||||
var page = document.GetPage(p);
|
||||
Assert.NotNull(page);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Issue1183()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user