pjfanning opened a new pull request, #1552: URL: https://github.com/apache/poi/pull/1552
Fixes #1547 `HemfPlusRegion.readNode()` and `EmfPlusRegionNode.init()` call each other once per nested AND/OR/XOR/EXCLUDE/COMPLEMENT node, with no depth limit. Each nested node takes only 4 bytes of input, so a small crafted EMF+ region throws `StackOverflowError`. That's an `Error`, so callers catching `IOException`/`RuntimeException` don't stop it. `readNode()` now tracks the depth and throws `RecordFormatException` past 1000 levels. The public `EmfPlusRegionNodeData.init(LittleEndianInputStream)` signature stays the same: `EmfPlusRegionNode` gets a private `init(leis, depth)` overload that `readNode()` calls, so there's no API change. `nodeCount` is still not enforced, because real files may store a wrong count. Added `TestHemfPlusRegion`: - `readsNestedNodes` checks that a small nested tree still parses. - `rejectsDeeplyNestedNodes` uses a 30,000-level AND chain. It fails with `StackOverflowError` without the fix. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
