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

Issue #165 #181

Merged
merged 1 commit into from
Apr 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions IlmBase/Imath/ImathInt64.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER

#if (defined _WIN32 || defined _WIN64) && _MSC_VER >= 1300
typedef unsigned __int64 Int64;
typedef __int64 SInt64;
#elif ULONG_MAX == 18446744073709551615LU
typedef long unsigned int Int64;
typedef long int SInt64;
#else
typedef long long unsigned int Int64;
typedef long long int SInt64;
#endif


Expand Down
20 changes: 10 additions & 10 deletions OpenEXR/IlmImf/ImfDwaCompressor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2392,15 +2392,15 @@ DwaCompressor::uncompress
"(truncated file).");
}

if (unknownUncompressedSize < 0 ||
unknownCompressedSize < 0 ||
acCompressedSize < 0 ||
dcCompressedSize < 0 ||
rleCompressedSize < 0 ||
rleUncompressedSize < 0 ||
rleRawSize < 0 ||
totalAcUncompressedCount < 0 ||
totalDcUncompressedCount < 0)
if ((SInt64)unknownUncompressedSize < 0 ||
(SInt64)unknownCompressedSize < 0 ||
(SInt64)acCompressedSize < 0 ||
(SInt64)dcCompressedSize < 0 ||
(SInt64)rleCompressedSize < 0 ||
(SInt64)rleUncompressedSize < 0 ||
(SInt64)rleRawSize < 0 ||
(SInt64)totalAcUncompressedCount < 0 ||
(SInt64)totalDcUncompressedCount < 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

If we don't want to add SInt64, I think most of these values can be sanity checked with initalizeBuffers()

{
throw Iex::InputExc("Error uncompressing DWA data"
" (corrupt header).");
Expand Down Expand Up @@ -2491,7 +2491,7 @@ DwaCompressor::uncompress
// start of the data block.
//

if ((version < 0) || (version > 2))
if (version > 2)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be fine -- we're just testing for bogus values read from the file. Garbage should show up as >2 if we're interpreting the values as unsigned.

throw Iex::InputExc ("Invalid version of compressed data block");

setupChannelData(minX, minY, maxX, maxY);
Expand Down
1 change: 1 addition & 0 deletions OpenEXR/IlmImf/ImfInt64.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER

using IMATH_NAMESPACE::Int64;
using IMATH_NAMESPACE::SInt64;

OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT

Expand Down