pjfanning opened a new pull request, #1550: URL: https://github.com/apache/poi/pull/1550
Fixes #1548 `BlockStore.ChainLoopDetector.claim()` only checked `offset >= used_blocks.length`, so a negative offset went straight to `used_blocks[offset]` and threw `ArrayIndexOutOfBoundsException`. A negative FAT sector entry in the header reaches it through `readCoreContents()` → `readBAT()`. Other chain walks that pass sector values to `claim()` can hit the same path with markers like -1 or -3. `claim()` now rejects negative offsets with an `IllegalStateException`, matching the existing loop-detected error. One check covers every caller. Added a parameterized test in `TestPOIFSFileSystem` that writes an empty file system, sets the first header FAT sector to `Integer.MIN_VALUE`, -1 or -3, and checks that reading it fails cleanly. All 3 cases fail 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]
