If addrProxy or addrSeparateProxyTor do not have a colon in the string somewhere in the QSettings storage, then attempting to open the options dialog will cause the entire program to crash.
Fixes #11209
If addrProxy or addrSeparateProxyTor do not have a colon in the string
somewhere in the QSettings storage, then attempting to open the options
dialog will cause the entire program to crash.
125@@ -126,6 +126,8 @@ void OptionsModel::Init(bool resetSettings)
126 settings.setValue("fUseProxy", false);
127 if (!settings.contains("addrProxy"))
128 settings.setValue("addrProxy", "127.0.0.1:9050");
129+ if (!settings.value("addrProxy").toString().contains(':'))
Please change PR description to say ‘Fixes #11209’ so that GitHub auto-closes the issue if this is merged.
If for some reason there was no colon, why doesn’t the default port just get appended to the existing IP rather than defaulting too?
Can’t reproduce the #11209 crash on OSX. Also, there are probably other situations where a corrupted or manually edited QSettings files may lead to a crash.
But this is better then noting.
Concept ACK
addrProxy
, so the value was 127.0.0.19050
. My though process was: corrupt? ok, rewrite. My goal was to avoid the crash.
utACK,
though I’m not sure I agree the original issue is really an issue - this can only be reached by manually tampering with the settings, which can mess up the client in a lot of ways.
AFAIK it doesn’t fix the issue when the setting is changed in runtime externally.
I think the settings value should be validated when used. In this case the .split(":")[1]
wouldn’t crash. This is also relevant when a setting can be upgraded/extended to a new format and/or have default values for the missing bits (port in this case).
In this particular case I would say the fix could be the introduction/usage of a decent address parser.
utACK ce2418f considering it’s an remote use case.
AFAIK it doesn’t fix the issue when the setting is changed in runtime externally.
The setting is only ever loaded from the qsettings at startup. Changing it at runtime externally does nothing.