Skip to content

Commit bfe3277

Browse files
committed
Fix AcademySoftwareFoundation#4599: Perform endian byteswap on correct buffer area for PSD RLE decoding
Signed-off-by: Jesse Yurkovich <jesse.y@gmail.com>
1 parent da42ac2 commit bfe3277

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/psd.imageio/psdinput.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2233,6 +2233,7 @@ PSDInput::decompress_packbits(const char* src, char* dst,
22332233
int16_t header;
22342234
int length;
22352235

2236+
char* dst_start = dst;
22362237
while (src_remaining > 0 && dst_remaining > 0) {
22372238
header = *reinterpret_cast<const signed char*>(src);
22382239
src++;
@@ -2275,8 +2276,8 @@ PSDInput::decompress_packbits(const char* src, char* dst,
22752276

22762277
if (!bigendian()) {
22772278
switch (m_header.depth) {
2278-
case 16: swap_endian((uint16_t*)dst, m_spec.width); break;
2279-
case 32: swap_endian((uint32_t*)dst, m_spec.width); break;
2279+
case 16: swap_endian((uint16_t*)dst_start, m_spec.width); break;
2280+
case 32: swap_endian((uint32_t*)dst_start, m_spec.width); break;
22802281
}
22812282
}
22822283

0 commit comments

Comments
 (0)