Crash when starting Project Monitor
Daniel Sahlberg via TortoiseSVN-dev <[email protected]> Thu, 6 Mar 2025 04:58:16 -0800 (PST)
| Newsgroups | gmane.comp.version-control.subversion.tortoisesvn.devel |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_38652_834753750.1741265896373
Content-Type: multipart/alternative;
boundary="----=_Part_38653_1739318060.1741265896373"
------=_Part_38653_1739318060.1741265896373
Content-Type: text/plain; charset="UTF-8"
Hi,
I've encountered a crash when starting Project Monitor (or probably rather
when it does the first check of the monitored repos).
I've debugged it and the crash occurs in LogDlg.Cpp:
callback->SetAuthData(CStringUtils::Decrypt(item.userName).get(),
CStringUtils::Decrypt(item.password).get());
From what I can tell, the call to CryptUnprotectData fails, returning a
nullptr and the call to .get() above fails.
if (CryptUnprotectData(&blobIn, &descr, nullptr, nullptr, nullptr,
CRYPTPROTECT_UI_FORBIDDEN, &blobOut) == FALSE)
return nullptr;
MonitoringData.ini contains the username and password (among other things):
[item_000]
password=01 00 [...] d7
username=01 00 [...] 19
I can also see that this read in correctly and used in the call to
CStringUtils::Decrypt() so I can only assume that something has changed
which caused the encrypted data to become invalid. Granted, this is invalid
data, but it shouldn't cause a crash.
How about the following change?
[[[
--- C:/Users/daniel/AppData/Local/Temp/LogDlg.cpp-revBASE.svn001.tmp.cpp fre
sep 15 19:59:11 2023
+++ C:/devel/tsvn_trunk/src/TortoiseProc/LogDialog/LogDlg.cpp tor mar 6
13:55:49 2025
@@ -8723,8 +8723,10 @@ void CLogDlg::MonitorEditProject(MonitorItem* pPro
{
dlg.m_sName = pProject->name;
dlg.m_sPathOrURL = pProject->wcPathOrUrl;
- dlg.m_sUsername =
CStringUtils::Decrypt(pProject->userName).get();
- dlg.m_sPassword =
CStringUtils::Decrypt(pProject->password).get();
+ auto username = CStringUtils::Decrypt(pProject->userName);
+ dlg.m_sUsername = username == nullptr ? CString("") :
username.get();
+ auto password = CStringUtils::Decrypt(pProject->password);
+ dlg.m_sPassword = password == nullptr ? CString("") :
password.get();
dlg.m_monitorInterval = pProject->interval;
dlg.m_sIgnoreRegex = pProject->sMsgRegex;
dlg.m_isParentPath = pProject->parentPath;
@@ -9009,7 +9011,11 @@ void CLogDlg::MonitorThread()
// we have to include the authentication in the URL itself
auto tempFile =
CTempFiles::Instance().GetTempFilePath(true);
auto callback = std::make_unique<CCallback>();
-
callback->SetAuthData(CStringUtils::Decrypt(item.userName).get(),
CStringUtils::Decrypt(item.password).get());
+ auto username = CStringUtils::Decrypt(item.userName);
+ auto password = CStringUtils::Decrypt(item.password);
+ if (username == nullptr || password == nullptr)
+ continue;
+ callback->SetAuthData(username.get(), password.get());
DeleteFile(tempFile.GetWinPath());
HRESULT hResUdl = URLDownloadToFile(nullptr,
item.wcPathOrUrl, tempFile.GetWinPath(), 0, callback.get());
if (m_bCancelled)
@@ -9134,7 +9140,11 @@ void CLogDlg::MonitorThread()
sCheckInfo.Format(IDS_MONITOR_CHECKPROJECT,
static_cast<LPCWSTR>(item.name));
if (!m_bCancelled)
SetDlgItemText(IDC_LOGINFO, sCheckInfo);
-
svn.SetAuthInfo(CStringUtils::Decrypt(item.userName).get(),
CStringUtils::Decrypt(item.password).get());
+ auto username = CStringUtils::Decrypt(item.userName);
+ auto password = CStringUtils::Decrypt(item.password);
+ if (username == nullptr || password == nullptr)
+ continue;
+ svn.SetAuthInfo(username.get(), password.get());
svn_revnum_t head = svn.GetHEADRevision(wcPathOrUrl,
false);
if (m_bCancelled)
continue;
@@ -9293,6 +9303,8 @@ void CLogDlg::MonitorThread()
{
auto du = CStringUtils::Decrypt(item.userName);
auto dp = CStringUtils::Decrypt(item.password);
+ if (du == nullptr || dp == nullptr)
+ continue;
std::wstring sU;
std::wstring sP;
auto pU = du.get();
]]]
I don't know if it would also make sense to set item.authFailed?
Kind regards,
Daniel
--
You received this message because you are subscribed to the Google Groups "TortoiseSVN-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/tortoisesvn-dev/8daeb531-f5ec-4923-a69a-2d9addb0a19bn%40googlegroups.com.
------=_Part_38653_1739318060.1741265896373
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Hi,<div><br /></div><div>I've encountered a crash when starting Project Mon=
itor (or probably rather when it does the first check of the monitored repo=
s).</div><div><br /></div><div>I've debugged it and the crash occurs in Log=
Dlg.Cpp:</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
callback->SetAuthData(CStringUtils::Decrypt(item.userName).get(), CStrin=
gUtils::Decrypt(item.password).get());</div><div><br /></div><div>From what=
I can tell, the call to CryptUnprotectData fails, returning a nullptr and =
the call to .get() above fails.</div><div>=C2=A0 =C2=A0 if (CryptUnprotectD=
ata(&blobIn, &descr, nullptr, nullptr, nullptr, CRYPTPROTECT_UI_FOR=
BIDDEN, &blobOut) =3D=3D FALSE)<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 return=
nullptr;<br /></div><div><br /></div><div>MonitoringData.ini contains the =
username and password (among other things):</div><div>[item_000]</div><div>=
<div>password=3D01 00 [...]=C2=A0d7<br /></div><div>username=3D01 00 [...] =
19<br /></div><div><br /></div><div>I can also see that this read in correc=
tly and used in the call to CStringUtils::Decrypt() so I can only assume th=
at something has changed which caused the encrypted data to become invalid.=
Granted, this is invalid data, but it shouldn't cause a crash.</div><div><=
br /></div><div>How about the following change?</div><div><br /></div><div>=
[[[</div><div>--- C:/Users/daniel/AppData/Local/Temp/LogDlg.cpp-revBASE.svn=
001.tmp.cpp<span style=3D"white-space: pre;"> </span>fre sep 15 19:59:11 20=
23<br />+++ C:/devel/tsvn_trunk/src/TortoiseProc/LogDialog/LogDlg.cpp<span =
style=3D"white-space: pre;"> </span>tor mar =C2=A06 13:55:49 2025<br />@@ -=
8723,8 +8723,10 @@ void CLogDlg::MonitorEditProject(MonitorItem* pPro<br />=
=C2=A0 =C2=A0 =C2=A0{<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dlg.m_sName =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D pProject->name;<br />=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0dlg.m_sPathOrURL =C2=A0 =C2=A0 =C2=A0=3D pProject-&=
gt;wcPathOrUrl;<br />- =C2=A0 =C2=A0 =C2=A0 =C2=A0dlg.m_sUsername =C2=A0 =
=C2=A0 =C2=A0 =3D CStringUtils::Decrypt(pProject->userName).get();<br />=
- =C2=A0 =C2=A0 =C2=A0 =C2=A0dlg.m_sPassword =C2=A0 =C2=A0 =C2=A0 =3D CStri=
ngUtils::Decrypt(pProject->password).get();<br />+ =C2=A0 =C2=A0 =C2=A0 =
=C2=A0auto username =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D CStringUtils::Decrypt(p=
Project->userName);<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0dlg.m_sUsername =
=C2=A0 =C2=A0 =C2=A0 =3D username =3D=3D nullptr ? CString("") : username.g=
et();<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0auto password =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =3D CStringUtils::Decrypt(pProject->password);<br />+ =C2=A0 =C2=
=A0 =C2=A0 =C2=A0dlg.m_sPassword =C2=A0 =C2=A0 =C2=A0 =3D password =3D=3D n=
ullptr ? CString("") : password.get();<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0dlg.m_monitorInterval =3D pProject->interval;<br />=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0dlg.m_sIgnoreRegex =C2=A0 =C2=A0=3D pProject->sMsgRegex=
;<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dlg.m_isParentPath =C2=A0 =C2=A0=
=3D pProject->parentPath;<br />@@ -9009,7 +9011,11 @@ void CLogDlg::Moni=
torThread()<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0// we have to include the authentication in the URL itself<br />=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0auto tempFile =
=3D CTempFiles::Instance().GetTempFilePath(true);<br />=C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0auto callback =3D std::make_uniqu=
e<CCallback>();<br />- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0callback->SetAuthData(CStringUtils::Decrypt(item.userName).get=
(), CStringUtils::Decrypt(item.password).get());<br />+ =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0auto username =3D CStringUtils::Decry=
pt(item.userName);<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0auto password =3D CStringUtils::Decrypt(item.password);<br />+ =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (username =3D=3D nullpt=
r || password =3D=3D nullptr)<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0continue;<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0callback->SetAuthData(username.get(), passwo=
rd.get());<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0DeleteFile(tempFile.GetWinPath());<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0HRESULT hResUdl =3D URLDownloadToFile(nullpt=
r, item.wcPathOrUrl, tempFile.GetWinPath(), 0, callback.get());<br />=C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (m_bCancelled)<b=
r />@@ -9134,7 +9140,11 @@ void CLogDlg::MonitorThread()<br />=C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sCheckInfo.Format(IDS_MONI=
TOR_CHECKPROJECT, static_cast<LPCWSTR>(item.name));<br />=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (!m_bCancelled)<br /=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0SetDlgItemText(IDC_LOGINFO, sCheckInfo);<br />- =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0svn.SetAuthInfo(CStringUtils::Decrypt(item.u=
serName).get(), CStringUtils::Decrypt(item.password).get());<br />+ =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0auto username =3D CStringUt=
ils::Decrypt(item.userName);<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0auto password =3D CStringUtils::Decrypt(item.password);<br=
/>+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (username =
=3D=3D nullptr || password =3D=3D nullptr)<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0continue;<br />+ =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0svn.SetAuthInfo(username.get(), p=
assword.get());<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0svn_revnum_t head =3D svn.GetHEADRevision(wcPathOrUrl, false);<br=
/>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (m_bCan=
celled)<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0continue;<br />@@ -9293,6 +9303,8 @@ void CLogDlg::MonitorThr=
ead()<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0{<=
br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0auto =C2=A0 =C2=A0 =C2=A0 =C2=A0 du =3D CStringUtils::Decrypt(item.us=
erName);<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0auto =C2=A0 =C2=A0 =C2=A0 =C2=A0 dp =3D CStringUtils::Decr=
ypt(item.password);<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0if (du =3D=3D nullptr || dp =3D=3D nullptr)<br />+ =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0continue;<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0std::wstring sU;<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0std::wstring sP;<br />=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0au=
to =C2=A0 =C2=A0 =C2=A0 =C2=A0 pU =3D du.get();<br /></div><div>]]]</div><d=
iv><br /></div><div>I don't know if it would also make sense to set item.au=
thFailed?</div><div><br /></div></div><div>Kind regards,</div><div>Daniel</=
div><div><br /></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;TortoiseSVN-dev" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">tor=
[email protected]</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
tortoisesvn-dev/8daeb531-f5ec-4923-a69a-2d9addb0a19bn%40googlegroups.com?ut=
m_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/tor=
toisesvn-dev/8daeb531-f5ec-4923-a69a-2d9addb0a19bn%40googlegroups.com</a>.<=
br />
------=_Part_38653_1739318060.1741265896373--
------=_Part_38652_834753750.1741265896373--