Bug 493466

Summary: Endianness bug in PCX reader’s peekHeader() method on big endian architectures
Product: [Frameworks and Libraries] frameworks-kimageformats Reporter: Aurélien COUDERC <coucouf>
Component: generalAssignee: Alex Merry <alex.merry>
Status: RESOLVED FIXED    
Severity: normal CC: aacid, kdelibs-bugs-null, mircomir
Priority: NOR    
Version First Reported In: 6.6.0   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

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.