You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "Tilman Hausherr (Jira)" <ji...@apache.org> on 2026/08/31 11:31:00 UTC

[jira] [Resolved] (TIKA-4857) embedded-limits.maxDepth counts parser layers, not embedding levels

     [ https://issues.apache.org/jira/browse/TIKA-4857?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tilman Hausherr resolved TIKA-4857.
-----------------------------------
    Fix Version/s: 4.1.0
       Resolution: Fixed

> 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
>             Fix For: 4.1.0
>
>
> 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)