Bug 493466 - Endianness bug in PCX reader’s peekHeader() method on big endian architectures
Summary: Endianness bug in PCX reader’s peekHeader() method on big endian architectures
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kimageformats
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: 6.6.0
Platform: Debian unstable Linux
: NOR normal
Target Milestone: ---
Assignee: Alex Merry
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-22 07:07 UTC by Aurélien COUDERC
Modified: 2024-09-30 05:42 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aurélien COUDERC 2024-09-22 07:07:29 UTC
When reading from a sequential device, the peekHeader() method in
the PCX readers reads the header from its defined little endian
endianness into the arch-specific endianness of the current
architecture for multibyte types.

Being a "peek" method, it then tries to push back the bytes into
the device after reading for its next use, but it doesn’t convert
multibyte types correctly from arch-specifice endianness back into
the initial little endian format.

Subsequent reading of the data from the device will thus lead to
incorrect values for multibyte types on the next use, where
quint16 types in the header have their bytes swapped.

I’ve proposed an MR here with a fix :
https://invent.kde.org/frameworks/kimageformats/-/merge_requests/258
Comment 1 Mirco Miranda 2024-09-30 05:42:55 UTC
The fix was merged on the master.