From 863c43087f1848ca48e873d53751b09026511053 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Thu, 16 Mar 2017 15:51:33 +0100 Subject: [PATCH] Address 64bit MinGW compile warning (fixes #15) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ../../../xmlparse.c: In function ‘generate_hash_secret_salt’: ../../../xmlparse.c:725:42: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] gather_time_entropy() ^ getpid() ^ (unsigned long)parser; ^ Thanks to Viktor Szakats. --- expat/Changes | 1 + expat/lib/xmlparse.c | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/expat/Changes b/expat/Changes index c34a7b0f..9a7bf64f 100644 --- a/expat/Changes +++ b/expat/Changes @@ -23,6 +23,7 @@ Release ?????????? Rhodri James Sergei Nikulov Tobias Taschner + Viktor Szakats Release 2.2.0 Tue June 21 2016 Security fixes: diff --git a/expat/lib/xmlparse.c b/expat/lib/xmlparse.c index e959c09d..bb8c9a72 100644 --- a/expat/lib/xmlparse.c +++ b/expat/lib/xmlparse.c @@ -719,6 +719,14 @@ gather_time_entropy(void) static unsigned long generate_hash_secret_salt(XML_Parser parser) { +#if defined(__UINTPTR_TYPE__) +# define PARSER_CAST(p) (__UINTPTR_TYPE__)(p) +#elif defined(_WIN64) && defined(_MSC_VER) +# define PARSER_CAST(p) (unsigned __int64)(p) +#else +# define PARSER_CAST(p) (p) +#endif + #ifdef __CloudABI__ unsigned long entropy; (void)parser; @@ -729,7 +737,7 @@ generate_hash_secret_salt(XML_Parser parser) /* Process ID is 0 bits entropy if attacker has local access * XML_Parser address is few bits of entropy if attacker has local access */ const unsigned long entropy = - gather_time_entropy() ^ getpid() ^ (unsigned long)parser; + gather_time_entropy() ^ getpid() ^ (unsigned long)PARSER_CAST(parser); /* Factors are 2^31-1 and 2^61-1 (Mersenne primes M31 and M61) */ if (sizeof(unsigned long) == 4) {