diff options
author | Ulf Hermann <[email protected]> | 2019-06-11 10:45:11 +0200 |
---|---|---|
committer | Ulf Hermann <[email protected]> | 2019-06-11 10:46:01 +0200 |
commit | 75075e4ef2b6f7f8de8f4baa12668f728545e697 (patch) | |
tree | 72aea67256380e55412e03fe82b9103a229772ca /src/qml/jsruntime/qv4memberdata.cpp | |
parent | 8cab87677a7ad61b63f778e945404c0bbe13e8c7 (diff) |
Avoid number conversion issue
Change-Id: Ia3f9bde43719859104759033283e697be72f7f53
Fixes: QTBUG-76286
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4memberdata.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4memberdata.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4memberdata.cpp b/src/qml/jsruntime/qv4memberdata.cpp index f327c85001..34b0c38ae6 100644 --- a/src/qml/jsruntime/qv4memberdata.cpp +++ b/src/qml/jsruntime/qv4memberdata.cpp @@ -72,8 +72,9 @@ Heap::MemberData *MemberData::allocate(ExecutionEngine *e, uint n, Heap::MemberD // The above code can overflow in a number of interesting ways. All of those are unsigned, // and therefore defined behavior. Still, apply some sane bounds. - if (alloc > std::numeric_limits<int>::max()) - alloc = std::numeric_limits<int>::max(); + const size_t intMax = std::numeric_limits<int>::max(); + if (alloc > intMax) + alloc = intMax; Heap::MemberData *m; if (old) { |