Re: Crash when starting Project Monitor
Daniel Sahlberg via TortoiseSVN-dev <[email protected]> Fri, 7 Mar 2025 05:25:48 -0800 (PST)
| Newsgroups | gmane.comp.version-control.subversion.tortoisesvn.devel |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_103142_785197647.1741353948550 Content-Type: multipart/alternative; boundary="----=_Part_103143_1543662793.1741353948550" ------=_Part_103143_1543662793.1741353948550 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable fredag 7 mars 2025 kl. 13:41:38 UTC+1 skrev Stefan: On Thursday, March 6, 2025 at 1:58:16=E2=80=AFPM UTC+1 [email protected]= m wrote: Hi, I've encountered a crash when starting Project Monitor (or probably rather= =20 when it does the first check of the monitored repos). I've debugged it and the crash occurs in LogDlg.Cpp: =20 callback->SetAuthData(CStringUtils::Decrypt(item.userName).get(),=20 CStringUtils::Decrypt(item.password).get()); From what I can tell, the call to CryptUnprotectData fails, returning a=20 nullptr and the call to .get() above fails. if (CryptUnprotectData(&blobIn, &descr, nullptr, nullptr, nullptr,=20 CRYPTPROTECT_UI_FORBIDDEN, &blobOut) =3D=3D FALSE) return nullptr; =20 returning a nullptr when the method is declared to return an=20 std::unique_ptr returns an empty unique_ptr. So calling .get() will never= =20 crash. but, unlike CString which one can assign a nullptr, one can not assign a=20 nullptr to an std string. So only that will crash. I took only part of your patch because as mentioned it's perfectly fine to= =20 assign a nullptr to a CString. Committed the fix in r29751 Stefan Great, thanks for the explanation! Daniel=20 --=20 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 e= mail to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/tortoisesvn= -dev/291edec5-a378-49b6-9c5e-89d00ded83e2n%40googlegroups.com. ------=_Part_103143_1543662793.1741353948550 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div><div dir=3D"auto">fredag 7 mars 2025 kl. 13:41:38 UTC+1 skrev Stefan:<= br /></div><blockquote style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px= solid rgb(204, 204, 204); padding-left: 1ex;"><div><div dir=3D"auto">On Th= ursday, March 6, 2025 at 1:58:16=E2=80=AFPM UTC+1 <a href=3D"" rel=3D"nofol= low">[email protected]</a> wrote:<br /></div><blockquote style=3D"margi= n: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-le= ft: 1ex;">Hi,<div><br /></div><div>I've encountered a crash when starting P= roject Monitor (or probably rather when it does the first check of the moni= tored repos).</div><div><br /></div><div>I've debugged it and the crash occ= urs in LogDlg.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).ge= t(), CStringUtils::Decrypt(item.password).get());</div><div><br /></div><di= v>From what I can tell, the call to CryptUnprotectData fails, returning a n= ullptr and the call to .get() above fails.</div><div>=C2=A0 =C2=A0 if (Cryp= tUnprotectData(&blobIn, &descr, nullptr, nullptr, nullptr, CRYPTPRO= TECT_UI_FORBIDDEN, &blobOut) =3D=3D FALSE)<br />=C2=A0 =C2=A0 =C2=A0 = =C2=A0 return nullptr;<br /></div></blockquote><div>=C2=A0</div></div><div>= <div><div>returning a nullptr when the method is declared to return an std:= :unique_ptr returns an empty unique_ptr. So calling .get() will never crash= .</div><div>but, unlike CString which one can assign a nullptr, one can not= assign a nullptr to an std string. So only that will crash.</div></div><di= v><br /></div><div>I took only part of your patch because as mentioned it's= perfectly fine to assign a nullptr to a CString.</div><div>Committed the f= ix in r29751</div><div><br /></div><div>Stefan</div></div></blockquote><div= ><br /></div><div>Great, thanks for the explanation!</div><div><br /></div>= <div>Daniel=C2=A0</div></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/291edec5-a378-49b6-9c5e-89d00ded83e2n%40googlegroups.com?ut= m_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/tor= toisesvn-dev/291edec5-a378-49b6-9c5e-89d00ded83e2n%40googlegroups.com</a>.<= br /> ------=_Part_103143_1543662793.1741353948550-- ------=_Part_103142_785197647.1741353948550--