I wanted to overwrite a large video file with a version that was encoded to a smaller size. The overwrite dialog told me the size difference was 16,0 EiB. I suspected some kind of overflow and could confirm as follows.
Steps to reproduce
1. Create two testfiles whose size differs in at least 2 GiB:
touch testfile1 # 0 byte
dd if=/dev/zero bs=1048576 count=2048 of=testfile2 # 2048 × 1 MiB
2. Try to rename testfile 1 to testfile 2 in Dolphin (or vice versa)
The correct size difference should be shown (2 GiB).
The difference is shown to be 16,0 EiB.
If testfile2 is created with 2047 blocks of 1 MiB instead of 2048 blocks, the size difference is shown as 2,0 GiB.
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/339
Git commit fc4d1cfc66e17f885ca4c22535031886832be685 by Méven Car.
Committed on 07/02/2021 at 19:13.
Pushed by meven into branch 'master'.
RenameDialog: fix a potential buffer overflow
M +1 -1 src/widgets/renamedialog.cpp
Thanks for fixing this!
> Thanks for fixing this!
And thanks to Frank for such a great bug report, that paved the way for the fix.