Bug 496612 - Kate crashes when pasting in overwrite mode (under specific circumstances)
Summary: Kate crashes when pasting in overwrite mode (under specific circumstances)
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: application (show other bugs)
Version: 24.08.1
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-23 17:17 UTC by dedale
Modified: 2024-11-23 17:53 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Screen recording showcasing the crash (1.10 MB, video/x-matroska)
2024-11-23 17:17 UTC, dedale
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dedale 2024-11-23 17:17:58 UTC
Created attachment 176065 [details]
Screen recording showcasing the crash

SUMMARY
Kate crashes when pasting in overwrite mode (if pasting creates additional lines and the cursor is on the first character of a line)

STEPS TO REPRODUCE
1. Open or create file using Kate
2. Copy several lines of text
3. Set Kate to Overwrite mode
4. Place the cursor on the first character of one of the last lines of the file
5. If pasting forces  Kate to create additional lines, the program will crash

OBSERVED RESULT
Crash to desktop

EXPECTED RESULT
Pasting lines and not crashing to desktop

SOFTWARE/OS VERSIONS 
Linux/KDE Plasma: 
KDE Plasma Version:  6.2.0
KDE Frameworks Version:  6.7.0
Qt Version:   6.7.2
X11

Reproduced it on two different Laptops, using Void Linux and EndeavourOS.
The crash is present on Kate 24.08.1 and on the nightly Appimage (kate-master-8492-linux-gcc-x86_64.AppImage)
Comment 1 Christoph Cullmann 2024-11-23 17:31:23 UTC
Can reproduce. Will take a look.
Comment 2 Christoph Cullmann 2024-11-23 17:52:52 UTC
Git commit dee786898a0d6077884c3f4c425c923ceca0937e by Christoph Cullmann.
Committed on 23/11/2024 at 17:52.
Pushed by cullmann into branch 'master'.

don't crash on insert at lastLine + 1

easy to trigger with overwrite paste

M  +19   -0    autotests/src/kateview_test.cpp
M  +1    -0    autotests/src/kateview_test.h
M  +1    -1    src/document/katedocument.cpp

https://invent.kde.org/frameworks/ktexteditor/-/commit/dee786898a0d6077884c3f4c425c923ceca0937e
Comment 3 Christoph Cullmann 2024-11-23 17:53:18 UTC
Thanks for the precise bug report, added a test, too, that we don't regress.