summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qhash.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2022-11-18 14:26:58 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2022-11-24 10:06:53 +0100
commit6c435e5dd41177308f22ba4b55931b2c463cb0d8 (patch)
treecd607b37ec21b3c6bb2bfa5862c0e4bc2dc4d44b /src/corelib/tools/qhash.cpp
parenta036bd1746a8be9d8d9f15d70f8d0258d1a4fc46 (diff)
Restore end-of-parse reporting to qstrntod()
Rework QSimpleParsedNumber to store a qsizetype whose sign serves as ok flag (positive is ok, zero and negative are not) and magnitude is the number of characters used. This replaces an endptr that was set to null to indicate !ok, but that deprived us of end-of-parse information, which is needed for number-parsing. In particular, JS's parsing of numbers accepts overflow (where qstrntod() flags it as invalid) as infinity; so qstrntod() does need to say how long the overflowing (but JS-valid, none the less) number-text was. Modify all callers of functions using this (recently-introduced) type and add tests that fail without this fix. Fixes: QTBUG-108628 Change-Id: I416cd213e1fb8101b1af5a6d43615b970a5db9b4 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/corelib/tools/qhash.cpp')
-rw-r--r--src/corelib/tools/qhash.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp
index a97fc50f3a..59d84f5094 100644
--- a/src/corelib/tools/qhash.cpp
+++ b/src/corelib/tools/qhash.cpp
@@ -113,7 +113,7 @@ private:
const char *seedstr = getenv("QT_HASH_SEED");
if (seedstr) {
auto r = qstrntoll(seedstr, strlen(seedstr), 10);
- if (r.endptr == seedstr + strlen(seedstr)) {
+ if (r.used > 0 && size_t(r.used) == strlen(seedstr)) {
if (r.result) {
// can't use qWarning here (reentrancy)
fprintf(stderr, "QT_HASH_SEED: forced seed value is not 0; ignored.\n");