SUMMARY When setting OSC 4 (RGB) color through escape sequences there doesn't seem to be a check against out 256 color range. Leading to a crash if some external software does this, a known example is pywal that has some special escape codes for some terminal emulators but without a way to check which terminal is a tty running on (that I know off) they have to send the same escape codes to all of them. While konsole handles its own color palette it still accepts those codes. STEPS TO REPRODUCE 1. Put ']4;257;#ff0000\]' in a file and cat it (running it through echo doesn't seem to work (don't know why) for this so reading from a file/script that contains the following command is needed. echo -n ']4;257;#ff0000\]' >"$(tty)" 2. Close the Konsole tab/split/window OBSERVED RESULT Konsole will crash instead of gracefully ending the session EXPECTED RESULT Konsole should not crash due to rogue escape sequences BACKTRACE I was unable to get a longer one Thread 1 "konsole" received signal SIGSEGV, Segmentation fault. QImage::~QImage (this=<optimized out>, this=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/gui/image/qimage.cpp:1061 1061 if (d && !d->ref.deref()) (gdb) c Continuing. KCrash: Application 'konsole' crashing... crashRecursionCounter = 2 Thread 1 "konsole" received signal SIGSEGV, Segmentation fault. __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=11, no_tid=no_tid@entry=0) at pthread_kill.c:44 44 return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0; (gdb) c Continuing. Couldn't get registers: No such process. SOFTWARE/OS VERSIONS Operating System: Arch Linux KDE Plasma Version: 6.2.80 KDE Frameworks Version: 6.7.0 Qt Version: 6.7.3 Kernel Version: 6.11.1-arch1-1 (64-bit) Graphics Platform: Wayland Processors: 12 × Intel® Core™ i7-9750H CPU @ 2.60GHz Memory: 31.2 GiB of RAM Graphics Processor: Mesa Intel® UHD Graphics 630 ADDITIONAL INFORMATION Setting it to -1 instead also crashes but this time right away instead when closing the session.
Created attachment 174479 [details] script with the osc 4 commands
A possibly relevant merge request was started @ https://invent.kde.org/utilities/konsole/-/merge_requests/1032
Actually this shorted copy-paste-able version of the commands produces the same crash echo '\e]4;-1;#ff0000\e]' echo '\e]4;257;#ff0000\e]'
Git commit faaf7cd17f3b87b402f44ff9dab80c0f1f6e73df by Matan Ziv-Av, on behalf of Luis Bocanegra. Committed on 07/10/2024 at 13:16. Pushed by matan into branch 'master'. Fix crash when sending OSC 4 (RGB) color outside the 256 range M +3 -0 src/Vt102Emulation.cpp https://invent.kde.org/utilities/konsole/-/commit/faaf7cd17f3b87b402f44ff9dab80c0f1f6e73df
Git commit 0f1738548fb7ec8e7db92a425181e3880271f43b by Matan Ziv-Av, on behalf of Luis Bocanegra. Committed on 07/10/2024 at 13:36. Pushed by matan into branch 'release/24.08'. Fix crash when sending OSC 4 (RGB) color outside the 256 range M +3 -0 src/Vt102Emulation.cpp https://invent.kde.org/utilities/konsole/-/commit/0f1738548fb7ec8e7db92a425181e3880271f43b