Bug 463683 - Null pointer access pasting from empty clipboard
Summary: Null pointer access pasting from empty clipboard
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: copy-paste (show other bugs)
Version: 22.12.0
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-01 00:26 UTC by Christopher Yeleighton
Modified: 2023-01-09 16:29 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Yeleighton 2023-01-01 00:26:28 UTC
SUMMARY
When the clipboard is empty (! QClipboard ::mimeData (QClipboard::Clipboard)), Konsole crashes on paste.


STEPS TO REPRODUCE
1. { konsole --platform vnc; }
2. Connect to the VNC server!
3. Tell Konsole to paste!

OBSERVED RESULT
#0  0x00007ffff6900d6b in QMimeData::hasUrls (this=this@entry=0x0)
    at ../../include/QtCore/../../src/corelib/text/qstring.h:967
967         Q_DECL_CONSTEXPR inline QString(QStringDataPtr dd) : d(dd.ptr) {}
#1  0x00007ffff7e995ff in Konsole::TerminalDisplay::pasteFromClipboard (this=0x555555973810, 
    appendEnter=<optimized out>)
    at /usr/src/debug/konsole-22.12.0/src/terminalDisplay/TerminalDisplay.cpp:2360
2360        if (!mimeData->hasUrls()) { // fast path if there are no urls

EXPECTED RESULT
The paste command should be disabled when the clipboard is empty.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: openSUSE Tumbleweed 20221230
(available in About System)
KDE Plasma Version: 5.26.4
KDE Frameworks Version: 5.101.0
Qt Version: 5.15.7

ADDITIONAL INFORMATION
Comment 1 Bug Janitor Service 2023-01-06 17:21:42 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/konsole/-/merge_requests/801
Comment 2 Kurt Hindenburg 2023-01-09 16:29:30 UTC
Git commit a991d8d9a470b1698c0f9a7577e97c5184fd8152 by Kurt Hindenburg, on behalf of Matan Ziv-Av.
Committed on 09/01/2023 at 15:57.
Pushed by hindenburg into branch 'master'.

When pasting from clipboard, check data is non null before dereferencing

QClipboard::mimeData may return nullptr.

M  +3    -0    src/terminalDisplay/TerminalDisplay.cpp

https://invent.kde.org/utilities/konsole/commit/a991d8d9a470b1698c0f9a7577e97c5184fd8152