SHA256
1
0
forked from pool/libHX

- Add 0001-string-resolve-testsuite-failure-with-aarch64.patch

OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libHX?expand=0&rev=123
This commit is contained in:
Jan Engelhardt 2023-11-29 01:09:09 +00:00 committed by Git OBS Bridge
parent 41d5a331b0
commit b6f859f542
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,38 @@
From 763c993419a6d59e6d2e1d7d60bc8d23981b5a94 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Tue, 28 Nov 2023 23:22:58 +0100
Subject: [PATCH] string: resolve testsuite failure with aarch64
Fixes: v4.17-9-g323210d
---
src/string.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/string.c b/src/string.c
index 11f3c9f..8e12b4a 100644
--- a/src/string.c
+++ b/src/string.c
@@ -1030,8 +1030,19 @@ EXPORT_SYMBOL unsigned long long HX_strtoull_unit(const char *s,
errno = ERANGE;
return ULLONG_MAX;
}
+ /*
+ * https://eel.is/c++draft/conv.double#2: values
+ * unrepresentable in the target type (such as forcing -5.2f
+ * into a uint) is UB. Thus check for range and apply the
+ * negation after the conversion to ULL.
+ */
+ if (q > ULLONG_MAX) {
+ errno = ERANGE;
+ return ULLONG_MAX;
+ }
+ unsigned long long r = q;
errno = 0;
- return neg ? -q : q;
+ return neg ? -r : r;
}
if (exponent == 0)
exponent = 1000;
--
2.43.0

View File

@ -9,6 +9,7 @@ Mon Nov 27 11:25:47 UTC 2023 - Jan Engelhardt <jengelh@inai.de>
* string: HX_strtoull_units & HX_strtoull_(n)sec now set * string: HX_strtoull_units & HX_strtoull_(n)sec now set
errno=ERANGE for nonrepresentable results errno=ERANGE for nonrepresentable results
* string: HX_strtoull_sec rejects unitless numbers now * string: HX_strtoull_sec rejects unitless numbers now
- Add 0001-string-resolve-testsuite-failure-with-aarch64.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Sun Nov 12 11:09:23 UTC 2023 - Jan Engelhardt <jengelh@inai.de> Sun Nov 12 11:09:23 UTC 2023 - Jan Engelhardt <jengelh@inai.de>