diff options
author | Leonard Lee <leonard.lee@digia.com> | 2013-08-19 09:13:55 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-30 08:47:30 (GMT) |
commit | ab4035d522eede6e6fb9251b521ab9e030fa13e3 (patch) | |
tree | 49670a6b02ccf5685d086a7efc50c4bca3a39686 /src/corelib/tools | |
parent | 764f1a51209212b6fc60cef5c12e9748d06b57de (diff) | |
download | Qt-ab4035d522eede6e6fb9251b521ab9e030fa13e3.zip Qt-ab4035d522eede6e6fb9251b521ab9e030fa13e3.tar.gz Qt-ab4035d522eede6e6fb9251b521ab9e030fa13e3.tar.bz2 |
Add Q_ASSERT in qAllocMore() function.
The negative range test is no longer needed in QByteArray's autotest.
Task-number: QTBUG-33038
Change-Id: I4d77e78e485b3b64a31dffd99b9fe2c14420d0a2
(partial cherry picked from qtbase commit fb8be9905d5f3216edc3fbb72b8ce1c380737eac)
(partial cherry picked from qtbase commit 0ed3cf2a1c487387bbc958317c791c9c53cf5a16)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 121f45f..b91b0f2 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -69,6 +69,9 @@ int qFindByteArray( int qAllocMore(int alloc, int extra) { + Q_ASSERT(alloc >= 0 && extra >= 0); + Q_ASSERT_X(alloc < (1 << 30) - extra, "qAllocMore", "Requested size is too large!"); + if (alloc == 0 && extra == 0) return 0; const int page = 1 << 12; |