aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4string.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-11-15 10:55:46 +0100
committerLiang Qi <liang.qi@qt.io>2016-11-15 10:57:49 +0100
commit365a3ac6ae50eb53253eca92bfdf4c527b3a5c05 (patch)
treec6fa0bf4ccf698fa75e2ebc245f95e424438b13a /src/qml/jsruntime/qv4string.cpp
parentdaa866a196962beb6171f847bd6f691f3ae38300 (diff)
parent8ff69297eeddc3f5650c4cc5517c7e2eafaf6c59 (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.cpp12
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;
}