Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/UglyToad.PdfPig.Fonts/TrueType/Tables/GlyphDataTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,15 @@ private static SimpleGlyphFlags[] ReadFlags(TrueTypeDataBytes data, int pointCou

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;
Expand Down
Binary file not shown.
15 changes: 15 additions & 0 deletions src/UglyToad.PdfPig.Tests/Integration/GithubIssuesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
Loading