-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix: prevent integer overflow and OOB write in PSDDecoder #9881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -373,6 +373,13 @@ LinearImage PSDDecoder::decode() { | |
| uint32_t width = ntohl(h.width); | ||
| uint32_t height = ntohl(h.height); | ||
|
|
||
| if (width == 0 || height == 0) { | ||
| throw std::runtime_error("invalid PSD dimensions: width and height must be non-zero"); | ||
| } | ||
| if (width > 300000 || height > 300000) { | ||
|
||
| throw std::runtime_error("PSD dimensions exceed maximum allowed size"); | ||
| } | ||
|
|
||
| uint32_t length; | ||
|
|
||
| // color mode data section | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check looks valid. But could you add comments what this checks mean?