Skip to content

Commit

Permalink
Merge pull request #1975 from SemanticsOS/lambdafu/pycms-overflow
Browse files Browse the repository at this point in the history
Fix integer overflow on ILP32 systems (32-bit Linux).
  • Loading branch information
wiredfool committed Jun 21, 2016
2 parents 4c01dc6 + 6f81501 commit c9d92e2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions _imagingcms.c
Original file line number Diff line number Diff line change
Expand Up @@ -983,12 +983,9 @@ cms_profile_getattr_attributes(CmsProfileObject* self, void* closure)
{
cmsUInt64Number attr;
cmsGetHeaderAttributes(self->profile, &attr);
#ifdef _WIN32
// Windows is weird this way.
return PyLong_FromLongLong((long long) attr);
#else
return PyInt_FromLong((long) attr);
#endif
/* This works just as well on Windows (LLP64), 32-bit Linux
(ILP32) and 64-bit Linux (LP64) systems. */
return PyLong_FromUnsignedLongLong((unsigned long long) attr);
}

static PyObject*
Expand Down

0 comments on commit c9d92e2

Please sign in to comment.