linux: cefclient crash when opening print dialog from pdf viewer

Issue #3207 open
Micha Ahrweiler created an issue

When a pdf in cefclient is opened and the print button inside the pdf viewer is clicked, cefclient segfaults.

This is due to ClientPrintHandlerGtk::OnPrintStart not being called before ClientPrintHandlerGtk::OnPrintSettings, so ClientPrintHandlerGtk::PrintHandler::OnPrintSettings is invoked on NULL.

This happens with and without --use-views, but not with --use-views --enable-chrome-runtime even when selecting ‘Print using system dialog…’.

One way of mitigating this inside cefclient would be to call OnPrintStart inside OnPrintSettings, if it hadn’t been called before, but this of course still violates the documentation on CefPrintHandler::OnPrintStart.

Tested under debian 11, gnome and cefclient 95.7.12+g99c4ac0+chromium-95.0.4638.54. In M88 the issue also happens. In M86 no dialog opens but also no crash, but might be a different issue.

In M84 the issue does not happen with our own application, but I couldn’t confirm with cefclient.

Comments (4)

  1. Josep Torra

    I’d just reproduced this issue myself using the following steps in Ubuntu 18.04.

    Installled updated cmake following

    tar xvf cef_binary_100.0.11+g45b9728+chromium-100.0.4896.46_linux64_beta.tar.bz2
    cd cef_binary_100.0.11+g45b9728+chromium-100.0.4896.46_linux64_beta
    cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release .
    make -j8 cefclient
    cd tests/cefclient/Release
    ./cefclient --url=

    And got the following backtrace.

    #0  0x000055e2ad1cbddd in client::ClientPrintHandlerGtk::PrintHandler::OnPrintSettings(scoped_refptr<CefPrintSettings>, bool) ()
    [Current thread is 1 (Thread 0x7f46b4a35c40 (LWP 15334))]
    (gdb) bt
    #0  0x000055e2ad1cbddd in client::ClientPrintHandlerGtk::PrintHandler::OnPrintSettings(scoped_refptr<CefPrintSettings>, bool) ()
    #1  0x000055e2ad1cc5ac in client::ClientPrintHandlerGtk::OnPrintSettings(scoped_refptr<CefBrowser>, scoped_refptr<CefPrintSettings>, bool) ()
    #2  0x000055e2ad233d56 in (anonymous namespace)::print_handler_on_print_settings(_cef_print_handler_t*, _cef_browser_t*, _cef_print_settings_t*, int) ()
    #3  0x00007f46ab20f41a in OnPrintSettings () at ../../cef/libcef_dll/ctocpp/
    #4  0x00007f46ae67c77b in UpdateSettings () at ../../cef/libcef/browser/printing/
    #5  0x00007f46b0f22bfe in printing::PrintingContextLinux::UseDefaultSettings() () at ../../printing/
    #6  0x00007f46b0a2f8ef in UseDefaultSettings () at ../../chrome/browser/printing/

    Please could you verify that is really fixed and point us which is the fix.

  2. Log in to comment