From bd661bde8daff88ec6d977d6c3ca88577680f9cc Mon Sep 17 00:00:00 2001 From: Giuseppe Castagno Date: Wed, 11 Nov 2015 11:50:43 +0100 Subject: [PATCH] Related tdf#90249 A reinterpretation of the previous fix... ...which lives in commit f75c1966a6869eb043debbcb4432a6b12f874d10. The previous fix didn't address correctly all the LO versions available (32 and 64 bit for all the platforms), it's needed in all supported platforms. Change-Id: I24728e0a86df3cc2b2073a8487b63c6739596feb Reviewed-on: https://gerrit.libreoffice.org/19922 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- external/neon/UnpackedTarball_neon.mk | 10 ---- .../neon/neon_fix_lock_timeout_windows.patch | 48 +++++++++++-------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/external/neon/UnpackedTarball_neon.mk b/external/neon/UnpackedTarball_neon.mk index 9cce366fc0d2..dacf425fa80f 100644 --- a/external/neon/UnpackedTarball_neon.mk +++ b/external/neon/UnpackedTarball_neon.mk @@ -17,7 +17,6 @@ $(eval $(call gb_UnpackedTarball_add_files,neon,src,\ $(eval $(call gb_UnpackedTarball_set_patchlevel,neon,0)) -ifeq ($(OS),WNT) $(eval $(call gb_UnpackedTarball_add_patches,neon,\ external/neon/neon.patch \ external/neon/neon_ne_set_request_flag.patch \ @@ -26,14 +25,5 @@ $(eval $(call gb_UnpackedTarball_add_patches,neon,\ external/neon/neon_fix_lock_token_on_if.patch \ external/neon/neon_fix_lock_timeout_windows.patch \ )) -else -$(eval $(call gb_UnpackedTarball_add_patches,neon,\ - external/neon/neon.patch \ - external/neon/neon_ne_set_request_flag.patch \ - external/neon/neon_with_gnutls.patch \ - external/neon/ubsan.patch \ - external/neon/neon_fix_lock_token_on_if.patch \ -)) -endif # vim: set noet sw=4 ts=4: diff --git a/external/neon/neon_fix_lock_timeout_windows.patch b/external/neon/neon_fix_lock_timeout_windows.patch index d6fe030d9e15..72abde762420 100644 --- a/external/neon/neon_fix_lock_timeout_windows.patch +++ b/external/neon/neon_fix_lock_timeout_windows.patch @@ -1,27 +1,37 @@ --- src.origin/ne_locks.c 2007-02-05 11:09:27.000000000 +0100 -+++ src/ne_locks.c 2015-11-08 17:21:52.968561488 +0100 -@@ -428,10 +428,20 @@ ++++ src/ne_locks.c 2015-11-11 16:12:11.236849082 +0100 +@@ -33,6 +33,10 @@ + #include + #endif + ++#ifdef HAVE_ERRNO_H ++#include ++#endif ++ + #include /* for isdigit() */ + + #include "ne_alloc.h" +@@ -428,9 +432,21 @@ if (ne_strcasecmp(timeout, "infinite") == 0) { return NE_TIMEOUT_INFINITE; } else if (strncasecmp(timeout, "Second-", 7) == 0) { - long to = strtol(timeout+7, NULL, 10); - if (to == LONG_MIN || to == LONG_MAX) -- return NE_TIMEOUT_INVALID; -- return to; -+ // according RFC 4918 the value used for lock timeout is unsigned 32 bit -+ // see: -+ // adapt it to the 'long' used internally by neon instead -+ // LONG_MAX means around 68 years. -+ unsigned long to1 = strtoul(timeout+7, NULL, 10); -+ long to; -+ if (to1 >= LONG_MAX) -+ to = LONG_MAX - 1; -+ else -+ to = (long)to1; -+ NE_DEBUG(NE_DBG_LOCKS, "Received lock timeout: %ld\n", to); -+ if (to == LONG_MIN || to == LONG_MAX) -+ return NE_TIMEOUT_INVALID; -+ return to; ++ // according RFC 4918 the value used for lock timeout is unsigned 32 bit ++ // see: ++ // adapt it to the 'long' used internally by neon instead ++ errno = 0; ++ unsigned long to1 = strtoul(timeout+7, NULL, 10); ++ if (to1 == ULONG_MAX && errno == ERANGE) + return NE_TIMEOUT_INVALID; ++ NE_DEBUG(NE_DBG_LOCKS, "Parsed lock timeout: %lu\n", to1); ++ long to; ++ // LONG_MAX means around 68 years, ++ // more than enough for practical use ++ if (to1 > LONG_MAX) ++ return LONG_MAX; ++ else ++ to = (long)to1; + return to; } else { return NE_TIMEOUT_INVALID; - }