Crashes: If wallet is checking existence of wallet.dat in directory where access is denied then fs::exists() without ec parameter will cause wallet crash.
Reproduction steps on Linux platform:
- Type: mkdir ~/.bitcoin/crash
- Type: sudo chown root:root ~/.bitcoin/crash
- Run bitcoin-qt
- Go to menu “File” -> “Open Wallet”, wallet will crash immediately
It’s fixed by adding “ec” parameter into fs::exists() function to handle any error correctly.
Infinite loop: If iterator is not able to increment because of access denied to next level of recursive scan it will stay on the same position indefinitely causing wallet to stop responding.
Reproduction steps on Windows platform:
- Create new folder into bitcoin data folder (for example: %Appdata%\Roaming\Bitcoin\Loop)
- Deny access to newly created folder for current user
- Run bitcoin-qt.exe
- Go to menu “File” -> “Open Wallet”, wallet will hang indefinitely
It’s fixed by disabling recursion if iterator increment failed. This way iterator will continue to next record in current recursion level not trying to dive into inaccessible directory structure.