[Libreoffice-bugs] [Bug 130216] Safe mode: Show user profile fails to open the folder

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Mon Jan 27 21:02:52 UTC 2020


https://bugs.documentfoundation.org/show_bug.cgi?id=130216

--- Comment #5 from Mike Kaganski <mikekaganski at hotmail.com> ---
(In reply to Stephan Bergmann from comment #4)
> So looks like the call to
> 
> > if (SHGetFileInfoW(
> >         o3tl::toW(pathname.getStr()), 0, &info, sizeof info, SHGFI_ATTRIBUTES)
> >     == 0)
> 
> in CSysShExec::execute at
> <https://cgit.freedesktop.org/libreoffice/core/tree/shell/source/win32/
> SysShExec.cxx?id=d59ec4cd1660410fa1b18c50d2d83b1417a82ddc#n334> fails with
> zero when pathname contains a ".." segment.
> 
> Mike, any idea whether that is actually the case
> (<https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-
> shgetfileinfow> doesn't appear to mention something like that), and whether
> there is a workaround?

I tried to debug this, and indeed this is the case; SHGetFileInfoW internally
calls SHParseDisplayName, which fails for this path, and also at that moment,
GetLastError() returns ERROR_MORE_DATA (a leftover from some internal WinAPI).

I found out that calling PathResolve(pathWithTwoDots, nullptr, PRF_VERIFYEXISTS
| PRF_REQUIREABSOLUTE) puts corrected path into the pathWithTwoDots. I suppose
that could be a workaround for now... (but PathResolve has a nice-looking
warning :-( [1])

[1]
https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-pathresolve

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20200127/029175a2/attachment.htm>


More information about the Libreoffice-bugs mailing list