Skip to content
Commit 4306dce1 authored by Ahmad Samir's avatar Ahmad Samir Committed by David Faure
Browse files

[CopyJob] Fix crash when copying an already existing dir and pressing "Skip"

Summary:
In copyNextFile() if all files have been skipped QList::erase() will
return end() iterator, accessing the element it denotes will cause
a segmentation fault. Make sure the iterator is valid if it's changed
inside the while loop, if we're going to use it before control reaches
the loop condition.

Add a unit test.

BUG: 408350
FIXED-IN: 5.62.0

Test Plan:
kioclient5 copy SOME_DIR_WITH_FILES DEST
kioclient5 copy --interactive SOME_DIR_WITH_FILES DEST

- In the "folder already exists" dialog enable "Apply to all" then hit "Skip"
- Without the patch you'd get a segmentation fault, with the patch the copy
  should finish as expected

All unit tests passed (except kiocore-kacltest, but that's unrelated).

Reviewers: #frameworks, dfaure

Reviewed By: dfaure

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D23708
parent 67929716
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment