-
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.
Improve check for circular reference and throw exception
- Loading branch information
Showing
2 changed files
with
47 additions
and
4 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,16 +1,37 @@ | ||
namespace UglyToad.PdfPig.Tests.Integration | ||
{ | ||
using UglyToad.PdfPig.Core; | ||
using Xunit; | ||
|
||
public class XObjectFormTests | ||
{ | ||
[Fact] | ||
public void CanReadDocumentWithoutStackOverflow() | ||
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