BDB may choose to use a pagesize other than 4096. As such, the parser should use the pagesize given by the BDB file.
Fixes #31210
BDB may choose to use a pagesize other than 4096. As such, the parser
should use the pagesize given by the BDB file.
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/31222.
<!--021abf342d371248e50ceaed478a90ca-->
See the guideline for information on the review process.
| Type | Reviewers |
|---|---|
| Concept ACK | theStack |
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
<!--174a7506f384e20aa4161008e828411d-->
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
130 | @@ -132,10 +131,14 @@ def dump_bdb_kv(filename): 131 | # Read in the BDB file and start deserializing it 132 | pages = [] 133 | with open(filename, 'rb') as f: 134 | - data = f.read(PAGESIZE) 135 | + # Read the outer meta page for the page size. It will always be at least 512 bytes. 136 | + metadata = dump_meta_page(f.read(MIN_PAGESIZE))
Might want to do some basic checks on the pagesize; eg
MIN_PAGESIZE = 512
MAX_PAGESIZE = 65536
â‹®
assert pagesize >= MIN_PAGESIZE and pagesize <= MAX_PAGESIZE and (pagesize & (pagesize-1) == 0)