From 7f40d2e002e57702c34244f8d9d2efc0e316ab05 Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Sat, 20 Apr 2013 16:23:57 +0000 Subject: [PATCH] Add workaround for gcc bug on sparc/64bit PR: 52900 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1470183 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ server/core.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 70f440b596..eab3e0a237 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.5.0 + *) core: Add workaround for gcc bug on sparc/64bit. PR 52900. + [Stefan Fritsch] + *) htpasswd: Add -v option to verify a password. [Stefan Fritsch] *) htpasswd, htdbm: Fix password generation. PR 54735. [Stefan Fritsch] diff --git a/server/core.c b/server/core.c index 1a80a7e5de..db75898bee 100644 --- a/server/core.c +++ b/server/core.c @@ -4929,13 +4929,18 @@ AP_DECLARE(void) ap_random_insecure_bytes(void *buf, apr_size_t size) AP_DECLARE(apr_uint32_t) ap_random_pick(apr_uint32_t min, apr_uint32_t max) { apr_uint32_t number; +#if (!__GNUC__ || __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || \ + !__sparc__ || APR_SIZEOF_VOIDP != 8) + /* This triggers a gcc bug on sparc/64bit with gcc < 4.8, PR 52900 */ if (max < 16384) { apr_uint16_t num16; ap_random_insecure_bytes(&num16, sizeof(num16)); RAND_RANGE(num16, min, max, APR_UINT16_MAX); number = num16; } - else { + else +#endif + { ap_random_insecure_bytes(&number, sizeof(number)); RAND_RANGE(number, min, max, APR_UINT32_MAX); } -- 2.40.0