aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4value_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-04-16 13:35:13 +0200
committerLars Knoll <lars.knoll@qt.io>2018-05-02 14:19:41 +0000
commit613dede03b1fa742027072c5656ef6ccefc651ad (patch)
treeb9781c912b3a89ff39ad9a533513706002939a42 /src/qml/jsruntime/qv4value_p.h
parentf1162921dfba638585f2c10760443df003ae7e4c (diff)
Fixes when using getLength()
Do some more bounds checking to avoid crashes. Change-Id: I44e838c3577a9176628aa5e382d712eac9800203 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4value_p.h')
-rw-r--r--src/qml/jsruntime/qv4value_p.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h
index b89011a9a0..97c6ea23ff 100644
--- a/src/qml/jsruntime/qv4value_p.h
+++ b/src/qml/jsruntime/qv4value_p.h
@@ -824,7 +824,7 @@ inline unsigned int Value::toUInt32() const
inline qint64 Value::toLength() const
{
if (Q_LIKELY(integerCompatible()))
- return int_32();
+ return int_32() < 0 ? 0 : int_32();
double i = Primitive::toInteger(isDouble() ? doubleValue() : toNumberImpl());
if (i <= 0)
return 0;