Skip to content
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

prevent overflow in bytesPerDeepLineTable #1152

Merged

Conversation

peterhillman
Copy link
Contributor

Address https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38912
bytesPerDeepLineTable() used int to compute the number of uncompressed bytes per scanline for each channel, which could overflow. Switching to uint64_t should prevent this.
This also switches internal computation from size_t` to uint64_t and add an overflow test for architectures where size_t is less than 64 bits.

Signed-off-by: Peter Hillman [email protected]

@@ -131,7 +131,7 @@ bytesPerDeepLineTable (const Header &header,
{
const int ySampling = abs(c.channel().ySampling);
const int xSampling = abs(c.channel().xSampling);
const int pixelSize = pixelTypeSize (c.channel().type);
uint64_t pixelSize = pixelTypeSize (c.channel().type);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you remove the "const" for a reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. It's back again

Copy link
Member

@cary-ilm cary-ilm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cary-ilm cary-ilm merged commit 5a0adf1 into AcademySoftwareFoundation:master Sep 22, 2021
cary-ilm pushed a commit to cary-ilm/openexr that referenced this pull request Sep 23, 2021
…1152)

* prevent overflow in bytesPerDeepLineTable

Signed-off-by: Peter Hillman <[email protected]>

* restore zapped 'const' from ImfMisc

Signed-off-by: Peter Hillman <[email protected]>
cary-ilm pushed a commit that referenced this pull request Sep 29, 2021
* prevent overflow in bytesPerDeepLineTable

Signed-off-by: Peter Hillman <[email protected]>

* restore zapped 'const' from ImfMisc

Signed-off-by: Peter Hillman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants