Skip to content

Commit 9e3d977

Browse files
authored
Merge pull request #172 from adrg/fix-build-outlines-recursion
Prevent recursion when parsing outlines
2 parents 0761546 + da010a9 commit 9e3d977

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

model/reader.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ func (r *PdfReader) buildOutlineTree(obj core.PdfObject, parent *PdfOutlineTreeN
347347
}
348348

349349
// Resolve the reference to next
350-
if nextObj := dict.Get("Next"); nextObj != nil {
351-
nextObj = core.ResolveReference(nextObj)
350+
nextObj := core.ResolveReference(dict.Get("Next"))
351+
if nextObj != nil && nextObj != container {
352352
if _, isNull := nextObj.(*core.PdfObjectNull); !isNull {
353353
next, last, err := r.buildOutlineTree(nextObj, parent, &outlineItem.PdfOutlineTreeNode)
354354
if err != nil {

0 commit comments

Comments
 (0)