From 6f81501efd3370b8aa1d05536bda68aba7403950 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Tue, 21 Jun 2016 13:41:26 +0200 Subject: [PATCH] Fix integer overflow on ILP32 systems (32-bit Linux). --- _imagingcms.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/_imagingcms.c b/_imagingcms.c index a6f76eec8..a05e5cdc6 100644 --- a/_imagingcms.c +++ b/_imagingcms.c @@ -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*