DCHECK in SetInitialPathAndShowPicker

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

DCHECK in SetInitialPathAndShowPicker

Postby ndesktop » Thu Jul 15, 2021 2:06 am

("DCHECK in FileSystemChooseEntryFunction::SetInitialPathAndShowPicker" is too long for BB title)

In my for of CEF 90.4430.93 version (with many changes, admittedly) I am getting a crash in src/extensions/browser/api/file_system\file_system_api.cc.
It is a DCHECK(delegate) in FileSystemChooseEntryFunction::SetInitialPathAndShowPicker

I am not patching anything in Chrome, neither Chromium Embedded related to this.
It looks like a Save As... attempted on a PDF file (not sure if is really a file > saveas or a print to a PDF virtual printer invoking a save as from inside a PDF displayed file).
Callstack on Windows 10 build 19041.610 looks like this:
Code: Select all
>   libcef.dll!extensions::FileSystemChooseEntryFunction::SetInitialPathAndShowPicker(const base::FilePath & previous_path, const base::FilePath & suggested_name, const ui::SelectFileDialog::FileTypeInfo & file_type_info, ui::SelectFileDialog::Type picker_type, bool is_previous_path_directory) Line 694   C++
    libcef.dll!extensions::FileSystemChooseEntryFunction::Run() Line 766   C++
    libcef.dll!ExtensionFunction::RunWithValidation() Line 466   C++
    libcef.dll!extensions::ExtensionFunctionDispatcher::DispatchWithCallbackInternal(const ExtensionHostMsg_Request_Params & params, content::RenderFrameHost * render_frame_host, int render_process_id, const base::RepeatingCallback<void (ExtensionFunction::ResponseType, const base::ListValue &, const std::string &)> & callback) Line 383   C++
    libcef.dll!extensions::ExtensionFunctionDispatcher::Dispatch(const ExtensionHostMsg_Request_Params & params, content::RenderFrameHost * render_frame_host, int render_process_id) Line 253   C++
    [Inline Frame] libcef.dll!IPC::DispatchToMethodImpl(extensions::ExtensionWebContentsObserver * obj, void(extensions::ExtensionWebContentsObserver::*)(content::RenderFrameHost *, const ExtensionHostMsg_Request_Params &) method, content::RenderFrameHost * parameter, std::__1::tuple<ExtensionHostMsg_Request_Params> && tuple, std::__1::integer_sequence<unsigned long long,0>) Line 65   C++
    [Inline Frame] libcef.dll!IPC::DispatchToMethod(extensions::ExtensionWebContentsObserver * obj, void(extensions::ExtensionWebContentsObserver::*)(content::RenderFrameHost *, const ExtensionHostMsg_Request_Params &) method, content::RenderFrameHost * parameter, std::__1::tuple<ExtensionHostMsg_Request_Params> && tuple) Line 77   C++
    libcef.dll!IPC::MessageT<ExtensionHostMsg_Request_Meta,std::tuple<ExtensionHostMsg_Request_Params>,void>::Dispatch<extensions::ExtensionWebContentsObserver,extensions::ExtensionWebContentsObserver,content::RenderFrameHost,void (extensions::ExtensionWebContentsObserver::*)(content::RenderFrameHost *, const ExtensionHostMsg_Request_Params &)>(const IPC::Message * msg, extensions::ExtensionWebContentsObserver * obj, extensions::ExtensionWebContentsObserver * sender, content::RenderFrameHost * parameter, void(extensions::ExtensionWebContentsObserver::*)(content::RenderFrameHost *, const ExtensionHostMsg_Request_Params &) func) Line 144   C++
    libcef.dll!extensions::ExtensionWebContentsObserver::OnMessageReceived(const IPC::Message & message, content::RenderFrameHost * render_frame_host) Line 235   C++
    libcef.dll!content::WebContentsImpl::OnMessageReceived(content::RenderFrameHostImpl * render_frame_host, const IPC::Message & message) Line 1160   C++
    libcef.dll!content::RenderFrameHostImpl::OnMessageReceived(const IPC::Message & msg) Line 1937   C++
    libcef.dll!content::RenderProcessHostImpl::OnMessageReceived(const IPC::Message & msg) Line 3603   C++
    libcef.dll!IPC::ChannelProxy::Context::OnDispatchMessage(const IPC::Message & message) Line 326   C++
    [Inline Frame] libcef.dll!base::OnceCallback<void ()>::Run() Line 101   C++
    libcef.dll!base::TaskAnnotator::RunTask(const char * trace_event_name, base::PendingTask * pending_task) Line 163   C++
    libcef.dll!base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::sequence_manager::LazyNow * continuation_lazy_now) Line 352   C++
    libcef.dll!base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() Line 266   C++
    libcef.dll!base::MessagePumpForUI::DoRunLoop() Line 226   C++
    libcef.dll!base::MessagePumpWin::Run(base::MessagePump::Delegate * delegate) Line 83   C++
    libcef.dll!base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool application_tasks_allowed, base::TimeDelta timeout) Line 463   C++
    libcef.dll!base::RunLoop::Run(const base::Location & location) Line 135   C++
    libcef.dll!CefMainRunner::RunMessageLoop() Line 288   C++
    obk.exe!Application::_RunLoop() Line 1073   C++
    obk.exe!Application::Run(FrameworkDelegate * framework, void(*)(void *) pfnPostCreate, bool * pfShouldRestoreDesktop, std::unique_ptr<int,std::default_delete<int>> & subprocess_return_code) Line 180   C++
    obk.exe!Application::Execute(FrameworkDelegate * framework, HINSTANCE__ * hInstance, wchar_t * lpCmdLine, int nCmdShow, void(*)(void *) pfnPostCreate, bool * pfShouldRestoreDesktop, std::unique_ptr<int,std::default_delete<int>> & subprocess_return_code) Line 2483   C++
    obk.exe!Entrypoint::obkWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 1205   C++
    obk.exe!wWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 1394   C++
    [Inline Frame] obk.exe!invoke_main() Line 118   C++
    obk.exe!__scrt_common_main_seh() Line 288   C++
    kernel32.dll!BaseThreadInitThunk()   Unknown
    ntdll.dll!RtlUserThreadStart()   Unknown

I am unable to reproduce the issue locally.
The DCHECK(delegate) obviously does not crash in release, so what is crashing is the next line 689 where delegate->GetDefaultDirectory() is called.

Locals shows pretty normal:
picker_type SELECT_SAVEAS_FILE (4)
suggested_name {path_=0x000032bc0070bae0 L"SEPA-formulier-automatisch-betalen-Wmo.pdf" } const base::FilePath &
file_type_info {extensions={ size=1 } extension_description_overrides={ size=1 } include_all_files=true ...} const ui::SelectFileDialog::FileTypeInfo &
(file_type_info.extensions[0] is "pdf")
delegate sadly, this is optimized away and not available

FileSystemChooseEntryFunction::ExtensionFunction::source_url is
source_url_ "chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html" GURL
so this leads me to think we are in the PDF viewer.

I'm not really sure what to ask except the obvious question: does anyone encountered this/reproduces this error?
ndesktop
Master
 
Posts: 754
Joined: Thu Dec 03, 2015 10:10 am

Re: DCHECK in SetInitialPathAndShowPicker

Postby ndesktop » Thu Jul 22, 2021 11:02 am

I'm thinking a PDF with Javascript associated in a some kind of form, and that Javascript might call into fileSystem.chooseEntry ?
That might explain the crash since CEF does not supply a FileSystemDelegate.

Does this make sense ?
ndesktop
Master
 
Posts: 754
Joined: Thu Dec 03, 2015 10:10 am

Re: DCHECK in SetInitialPathAndShowPicker

Postby magreenblatt » Thu Jul 22, 2021 11:32 am

ndesktop wrote:I'm thinking a PDF with Javascript associated in a some kind of form, and that Javascript might call into fileSystem.chooseEntry ?
That might explain the crash since CEF does not supply a FileSystemDelegate.

Does this make sense ?

Yes, that seems possible. At a minimum, we could create a no-op version like ShellFileSystemDelegate to avoid the DCHECK. It would help if you can find/create a PDF that reproduces the problem.
magreenblatt
Site Admin
 
Posts: 12404
Joined: Fri May 29, 2009 6:57 pm

Re: DCHECK in SetInitialPathAndShowPicker

Postby ndesktop » Thu Jul 22, 2021 12:19 pm

magreenblatt wrote:It would help if you can find/create a PDF that reproduces the problem.

That I am trying to do now, thanks. As soon as I have a repro I'll follow up.
ndesktop
Master
 
Posts: 754
Joined: Thu Dec 03, 2015 10:10 am

Re: DCHECK in SetInitialPathAndShowPicker

Postby ndesktop » Wed Aug 11, 2021 2:01 am

I found a PDF which crashes exactly as in the crash dump reported from the market:
https://www.hetcak.nl/HETCAK/media/HetC ... en-Wmo.pdf

It is enough to fill something in the form (maybe even nothing), then click on the vertical arrow download.
This will open a menu with two entries
- With your changes
- Without your changes
Clicking on the "With your changes" will crash cefclient.
Tested with latest Chrome 92.0.4515.131 and it does not crash, it is invoking the Save As... dialog (normal, since FileSystemDelegate is present in Chrome).

Filed issue 3169.
ndesktop
Master
 
Posts: 754
Joined: Thu Dec 03, 2015 10:10 am

Re: DCHECK in SetInitialPathAndShowPicker

Postby magreenblatt » Wed Aug 11, 2021 9:23 am

Thanks
magreenblatt
Site Admin
 
Posts: 12404
Joined: Fri May 29, 2009 6:57 pm

Re: DCHECK in SetInitialPathAndShowPicker

Postby ndesktop » Thu Aug 19, 2021 2:15 pm

ndesktop
Master
 
Posts: 754
Joined: Thu Dec 03, 2015 10:10 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 26 guests