The read-only BDB parser follows page chains without tracking visited pages. A crafted BDB file with circular references causes an infinite loop with unbounded memory growth, crashing the process.
Add visited-page sets to both the BTree DFS traversal and overflow page chain traversal, throwing on the first revisited page.
Script to craft a .dat file which demonstrated the issue (should run and suck up memory until OOM): https://gist.github.com/instagibbs/f92c17c34bfefa4aa391cb2b9c6306de
Issue discovered/demo’d/fixed by Claude.