diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-07-18 17:20:04 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-07-20 13:15:57 +0200 |
commit | d6b38be3dfa4579cbe99cc442452a45779a71e70 (patch) | |
tree | b26b220163394c82677795411544399836c76d42 /src/corelib/text/qlocale_win.cpp | |
parent | d0aedfab0991b23aaa09746d6c9b83b8d28755c5 (diff) |
Port qt_repeatCount() to qsizetype
While it's true that the typical user of the function won't expect
more than half a dozen repeats, this function is fed with
user-supplied input, so it could be asked to return in excess of
INT_MAX matches. The truncation then means we're misreporting the
number mod INT_MAX, which is as good as a random number and leads to
false positive matches in users of the function.
Just return the true result instead of a truncated one.
Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-103531
Change-Id: I5e3aa23dec873c6f9af255e90748fb38619d2f5d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/text/qlocale_win.cpp')
-rw-r--r-- | src/corelib/text/qlocale_win.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/text/qlocale_win.cpp b/src/corelib/text/qlocale_win.cpp index f97d910451..f67965539b 100644 --- a/src/corelib/text/qlocale_win.cpp +++ b/src/corelib/text/qlocale_win.cpp @@ -729,7 +729,7 @@ QString QSystemLocalePrivate::winToQtFormat(QStringView sys_fmt) } QChar c = sys_fmt.at(i); - int repeat = qt_repeatCount(sys_fmt.mid(i)); + qsizetype repeat = qt_repeatCount(sys_fmt.mid(i)); switch (c.unicode()) { // Date |