From c70658d301e274c3aaa1fb6cebe2a5e56db12779 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 16 Dec 2014 14:24:55 -0800 Subject: Make sure we don't try to ask QByteArray to allocate too much QFile::readAll could be asked to read a file that is over 1 GB in size and thus cause an assertion: ASSERT failure in qAllocMore: "Requested size is too large!", ... The idea behind the existing code was correct, but the value was wrong. It prevented overflow of the integer size request, but didn't prevent overflowing the storage size. Change-Id: I072e6e419f47b639454f3fd96deb0f88d03e960c Reviewed-by: Martin Smith --- src/corelib/tools/qbytearray.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/corelib/tools/qbytearray.h') diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index f13b1c16cd..3bcc7b1f2a 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -173,6 +173,9 @@ private: typedef QTypedArrayData Data; public: + // undocumented: + static const quint64 MaxSize = (1 << 30) - sizeof(Data); + enum Base64Option { Base64Encoding = 0, Base64UrlEncoding = 1, -- cgit v1.2.3