A wallet file whose descriptor cache holds an invalid extended public key aborts the process at load, in an assertion in CPubKey::Derive.
Unserializing such a key leaves it empty. The cache loaders stored the empty key. A key is invalid if its public key is not a valid point, or if it has depth 0 and a non-zero child number or fingerprint. I return DBErrors::CORRUPT for such a record in both caches, as for a record of the wrong size. I tested this with the extended unit test, which fails without the change and passes with it. A modified wallet file aborted bitcoin-wallet before and reports a corrupt wallet now.
This is one of several PRs from a large audit of Bitcoin Core that I did with the help of LLM tools. The audit produced its evidence all at once, which is why the PRs arrive together. I understand each change fully and will answer review questions myself.