[
https://issues.apache.org/jira/browse/TIKA-4857?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18109853#comment-18109853
]
ASF GitHub Bot commented on TIKA-4857:
--------------------------------------
THausherr merged PR #3098:
URL: https://github.com/apache/tika/pull/3098
> embedded-limits.maxDepth counts parser layers, not embedding levels
> -------------------------------------------------------------------
>
> Key: TIKA-4857
> URL: https://issues.apache.org/jira/browse/TIKA-4857
> Project: Tika
> Issue Type: Bug
> Reporter: Dominik Schmidt
> Priority: Major
>
> The javadoc of EmbeddedLimits says maxDepth is the maximum nesting depth of
> embedded documents that are still parsed (maxDepth=1: depth 1 parsed, depth 2
> not). In practice maxDepth=2 parses depth 1 only; depth 2 needs maxDepth=3.
> Reproduced with RecursiveParserWrapper on a DOCX whose EMF thumbnail is
> rendered (the rendering is a depth-2 embedded document):
> - maxDepth 1: depth 1 only, tk:exception:embedded-depth-limit-reached set
> - maxDepth 2: depth 1 only, limit reached set
> - maxDepth 3: depth 1 and 2
> - maxDepth -1: everything
> ParseRecord.depth is incremented in CompositeParser.parse for every composite
> layer a parse passes through; with AutoDetectParser wrapping DefaultParser
> that is two increments per document level, and
> ParsingEmbeddedDocumentExtractor compares that counter with maxDepth + 1. The
> limit should be checked against the embedding depth (tk:embedded-depth of the
> child), independent of how parsers are composed. The same off-by-one applies
> to /unpack with embedded-limits in tika-server.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)