Menu

#159 psdParser::UnpackRLE() memory out of bounds.

open
nobody
None
5
2023-06-27
2023-06-27
No

Our team found a error where psdParser::UnpackRLE() could cause a memory out of bounds when loading certain psd images.
We found that the source code does not break the loop when the read line ends.

// assert we don't write beyound eol
memcpy(line, rle_line, line + len > line_end ? line_end - line : len);
// not break when line >= line_end
line += len;
rle_line += len;

How to reproduce the error:
Load the tst_memcpy.psd.

FIBITMAP *dib = FreeImage_Load(FREE_IMAGE_FORMAT::FIF_PSD, "./tst_memcpy.psd");

Here's a patch that might help fix the error.

3 Attachments

Discussion

Anonymous
Anonymous

Add attachments
Cancel