-
Notifications
You must be signed in to change notification settings - Fork 626
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
prevent overflow in bytesPerDeepLineTable #1152
Conversation
Signed-off-by: Peter Hillman <[email protected]>
src/lib/OpenEXR/ImfMisc.cpp
Outdated
@@ -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); |
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.
Did you remove the "const" for a reason?
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.
Oops. It's back again
Signed-off-by: Peter Hillman <[email protected]>
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.
LGTM
…1152) * prevent overflow in bytesPerDeepLineTable Signed-off-by: Peter Hillman <[email protected]> * restore zapped 'const' from ImfMisc Signed-off-by: Peter Hillman <[email protected]>
* prevent overflow in bytesPerDeepLineTable Signed-off-by: Peter Hillman <[email protected]> * restore zapped 'const' from ImfMisc Signed-off-by: Peter Hillman <[email protected]>
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 touint64_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]