-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check and handle circular references when processing XObject forms and …
…fix #671
- Loading branch information
Showing
4 changed files
with
72 additions
and
3 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
namespace UglyToad.PdfPig.Tests.Integration | ||
{ | ||
using UglyToad.PdfPig.Core; | ||
using Xunit; | ||
|
||
public class XObjectFormTests | ||
{ | ||
[Fact] | ||
public void CanReadDocumentWithoutStackOverflowIssue671() | ||
{ | ||
using (var document = PdfDocument.Open(IntegrationHelpers.GetDocumentPath("issue_671"))) | ||
{ | ||
var page = document.GetPage(1); | ||
} | ||
} | ||
|
||
[Fact] | ||
public void CanReadDocumentThrowsIssue671() | ||
{ | ||
using (var document = PdfDocument.Open(IntegrationHelpers.GetDocumentPath("issue_671"), ParsingOptions.LenientParsingOff)) | ||
{ | ||
var exception = Assert.Throws<PdfDocumentFormatException>(() => document.GetPage(1)); | ||
Assert.Contains("is referencing itself which can cause unexpected behaviour", exception.Message); | ||
} | ||
} | ||
|
||
[Fact] | ||
public void CanReadDocumentMOZILLA_3136_0() | ||
{ | ||
// This document does not actually contain circular references | ||
using (var document = PdfDocument.Open(IntegrationHelpers.GetDocumentPath("MOZILLA-3136-0"), ParsingOptions.LenientParsingOff)) | ||
{ | ||
var page = document.GetPage(1); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters