Bug 432610 - Size difference shown as 16,0 EiB if file size difference is larger than 2 GiB
Summary: Size difference shown as 16,0 EiB if file size difference is larger than 2 GiB
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: Overwrite dialog (show other bugs)
Version: 5.78.0
Platform: Archlinux Linux
: NOR normal
Target Milestone: ---
Assignee: KIO Bugs
Depends on:
Reported: 2021-02-07 14:32 UTC by Frank Steinmetzger
Modified: 2021-02-08 17:08 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.80


Note You need to log in before you can comment on or make changes to this bug.
Description Frank Steinmetzger 2021-02-07 14:32:26 UTC
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)

Expected result
The correct size difference should be shown (2 GiB).

Actual result
The difference is shown to be 16,0 EiB.

Additional information
If testfile2 is created with 2047 blocks of 1 MiB instead of 2048 blocks, the size difference is shown as 2,0 GiB.

Plasma 5.20.5
Frameworks 5.78.0
Qt 5.15.2
Comment 1 Bug Janitor Service 2021-02-07 19:14:09 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/339
Comment 2 Méven Car 2021-02-08 05:35:11 UTC
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

Comment 3 Nate Graham 2021-02-08 16:04:32 UTC
Thanks for fixing this!
Comment 4 Méven Car 2021-02-08 17:08:43 UTC
> Thanks for fixing this!

And thanks to Frank for such a great bug report, that paved the way for the fix.