https://bugs.kde.org/show_bug.cgi?id=507174
Bug ID: 507174
Summary: When overwriting an existing file, it is written into
instead
Classification: Applications
Product: Skanpage
Version First 25.04.3
Reported In:
Platform: Arch Linux
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
SUMMARY
When using the "Save All" button, and selecting an existing file, the user is
prompted whether they wish to overwrite that file. If they say yes, the
existing file is not removed. Instead, new PDF data is written into the
beginning of the existing file. If the existing file is larger than the new
data being written, the file is not truncated.
This bug is similar to https://en.wikipedia.org/wiki/ACropalypse since if the
resulting file is shared it may include any private data from the original
"overwritten" file.
STEPS TO REPRODUCE
1. Get a big PDF. I chose the 27MB Lancer core rulebook from
https://massif-press.itch.io/corebook-pdf-free
2. Run binwalk over the pdf and note the page start offsets
Example:
binwalk Lancer\ -\ Free\ Version.pdf
------------------------------------------------------------------------------------------------------------
DECIMAL HEXADECIMAL
DESCRIPTION
------------------------------------------------------------------------------------------------------------
0 0x0 PDF
document, version 1.7
8903 0x22C7 JPEG
image, total size: 497696 bytes
567138 0x8A762 JPEG
image, total size: 687848 bytes
1256109 0x132AAD JPEG
image, total size: 261110 bytes
1518597 0x172C05 JPEG
image, total size: 289003 bytes
1844873 0x1C2689 JPEG
image, total size: 415403 bytes
etc.
3. Run skanpage, scan one page with the "Scan" button, and save using the "Save
All" button. Choose the large pdf in the file picker and click Save, then click
Overwrite in the resulting popup.
4. binwalk the pdf again and note that page 1 has been overwritten, but most
other pages are still there at their original locations
Example:
binwalk Lancer\ -\ Free\ Version.pdf
------------------------------------------------------------------------------------------------------------
DECIMAL HEXADECIMAL
DESCRIPTION
------------------------------------------------------------------------------------------------------------
0 0x0 PDF
document, version 1.4
2027 0x7EB JPEG
image, total size: 994611 bytes
1256109 0x132AAD JPEG
image, total size: 261110 bytes
1518597 0x172C05 JPEG
image, total size: 289003 bytes
1844873 0x1C2689 JPEG
image, total size: 415403 bytes
There is a new jpeg from skanpage at offset 2027. The remaining jpegs at
offsets 1256109, 1518597, 1844873, etc. are all carried over from the original
large file.
SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux
KDE Plasma Version: 6.4.3
KDE Frameworks Version: 6.16.0
Qt Version: 6.9.1
--
You are receiving this mail because:
You are watching all bug changes.