diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-05-04 13:16:14 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-05-04 13:19:31 +0200 |
commit | 7f8719e663edae8b08d34cc67cb5000e8402d3d7 (patch) | |
tree | b098d2c8077a88c2ada577ac874e1416adaf66f7 /src/corelib/io/qiodevice.cpp | |
parent | af851c290b7cea22f26bb8c852b0029696469d74 (diff) | |
parent | eb82959d6688f9e58be4b67670afba3649f1f799 (diff) |
Merge remote-tracking branch 'origin/5.5' into HEAD
Change-Id: I487a4b7c05687a10c498ac219c31367d4db6fbc0
Diffstat (limited to 'src/corelib/io/qiodevice.cpp')
-rw-r--r-- | src/corelib/io/qiodevice.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 47484ad596..e73a200fb4 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -989,6 +989,10 @@ QByteArray QIODevice::readAll() // Size is unknown, read incrementally. qint64 readResult; do { + if (quint64(readBytes) + QIODEVICE_BUFFERSIZE > QByteArray::MaxSize) { + // If resize would fail, don't read more, return what we have. + break; + } result.resize(readBytes + QIODEVICE_BUFFERSIZE); readResult = read(result.data() + readBytes, QIODEVICE_BUFFERSIZE); if (readResult > 0 || readBytes == 0) |