guard both descriptor-cache loaders in LoadDescriptorWalletRecords so a wallet record whose serialized xpub is shorter than BIP32_EXTKEY_SIZE is rejected as corrupt instead of having CExtPubKey::Decode read a fixed 74 bytes past the end of the deserialized buffer, matching the length check key_io already does before Decode.
wallet: validate descriptor cache xpub length before decoding #35672
pull nabhan06 wants to merge 1 commits into bitcoin:master from nabhan06:wallet-descriptor-cache-xpub-length changing 2 files +53 −2-
nabhan06 commented at 6:32 AM on July 7, 2026: none
-
wallet: validate descriptor cache xpub length before decoding 975e014c71
- DrahtBot added the label Wallet on Jul 7, 2026
-
DrahtBot commented at 6:32 AM on July 7, 2026: contributor
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
Code Coverage & Benchmarks
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35672.
<!--021abf342d371248e50ceaed478a90ca-->
Reviews
See the guideline for information on the review process.
Type Reviewers Concept ACK pablomartin4btc If your review is incorrectly listed, please copy-paste <code><!--meta-tag:bot-skip--></code> into the comment that the bot should ignore.
<!--5faf32d7da4f0f540f40219e4f7537a3-->
-
in src/wallet/test/walletload_tests.cpp:124 in 975e014c71
119 | + } 120 | + { 121 | + // Write a parent-cache record whose value is a truncated xpub. 122 | + std::unique_ptr<DatabaseBatch> batch = database->MakeBatch(); 123 | + const std::vector<unsigned char> truncated_xpub(BIP32_EXTKEY_SIZE - 1, 0); 124 | + BOOST_CHECK(batch->Write(std::make_pair(std::make_pair(std::string{"walletdescriptorcache"}, desc_id), uint32_t{0}), truncated_xpub));
pablomartin4btc commented at 7:04 AM on July 7, 2026:Perhaps better to use
DBKeys::WALLETDESCRIPTORCACHEconst directly instead of hardcoded string... (it needs to be declared as extern inwalletdb.h)BOOST_CHECK(batch->Write(std::make_pair(std::make_pair(DBKeys::WALLETDESCRIPTORCACHE, desc_id), uint32_t{0}), truncated_xpub));pablomartin4btc commented at 7:12 AM on July 7, 2026: memberConcept ACK
The second fix (the
WALLETDESCRIPTORLHCACHEpath) has no test.maflcko commented at 7:52 AM on July 7, 2026: memberai slop.
Instead of creating an exact duplicate of a pre-existing pull request, it would be better to just leave your review on the existing pull request.
maflcko closed this on Jul 7, 2026ContributorsLabels
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-07-09 06:47 UTC