Skip to content

Commit

Permalink
Fix AcademySoftwareFoundation#4599: Perform endian byteswap on correc…
Browse files Browse the repository at this point in the history
…t buffer area for PSD RLE decoding

Signed-off-by: Jesse Yurkovich <jesse.y@gmail.com>
  • Loading branch information
jessey-git committed Jan 17, 2025
1 parent da42ac2 commit bfe3277
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/psd.imageio/psdinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2233,6 +2233,7 @@ PSDInput::decompress_packbits(const char* src, char* dst,
int16_t header;
int length;

char* dst_start = dst;
while (src_remaining > 0 && dst_remaining > 0) {
header = *reinterpret_cast<const signed char*>(src);
src++;
Expand Down Expand Up @@ -2275,8 +2276,8 @@ PSDInput::decompress_packbits(const char* src, char* dst,

if (!bigendian()) {
switch (m_header.depth) {
case 16: swap_endian((uint16_t*)dst, m_spec.width); break;
case 32: swap_endian((uint32_t*)dst, m_spec.width); break;
case 16: swap_endian((uint16_t*)dst_start, m_spec.width); break;
case 32: swap_endian((uint32_t*)dst_start, m_spec.width); break;
}
}

Expand Down

0 comments on commit bfe3277

Please sign in to comment.