diff options
author | Liang Qi <liang.qi@qt.io> | 2016-11-15 10:55:46 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-11-15 10:57:49 +0100 |
commit | 365a3ac6ae50eb53253eca92bfdf4c527b3a5c05 (patch) | |
tree | c6fa0bf4ccf698fa75e2ebc245f95e424438b13a /src/qml/jsruntime/qv4string.cpp | |
parent | daa866a196962beb6171f847bd6f691f3ae38300 (diff) | |
parent | 8ff69297eeddc3f5650c4cc5517c7e2eafaf6c59 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
src/qmldevtools/qmldevtools.pro
tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
Change-Id: I12255c16716bd8a74e7047cdb1f9302a4d1ea827
Diffstat (limited to 'src/qml/jsruntime/qv4string.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4string.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4string.cpp b/src/qml/jsruntime/qv4string.cpp index abef885249..a715b65db5 100644 --- a/src/qml/jsruntime/qv4string.cpp +++ b/src/qml/jsruntime/qv4string.cpp @@ -46,6 +46,7 @@ #include "qv4stringobject_p.h" #endif #include <QtCore/QHash> +#include <QtCore/private/qnumeric_p.h> using namespace QV4; @@ -63,10 +64,15 @@ static uint toArrayIndex(const QChar *ch, const QChar *end) uint x = ch->unicode() - '0'; if (x > 9) return UINT_MAX; - uint n = i*10 + x; - if (n < i) - // overflow + + uint n; + // n = i * 10 + x, with overflow checking + if (mul_overflow(i, 10u, &n)) return UINT_MAX; + + if (add_overflow(n, x, &n)) + return UINT_MAX; + i = n; ++ch; } |