From 9a04453b50ea22d6060aeb49250cf3e263d86ad3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 28 Jun 2018 18:36:36 -0700 Subject: Fix the fix for mmap() overflow check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code I introduced in 4ee74257940e2ed21b653b986ad02a746e8438a6 only dealt with systems that reasonably used a 64-bit off_t parameter. Turns out that we don't turn on largefile support on 32-bit Android, which meant that the fix caused a regression. [ChangeLog][QtCore][QFile] Fixed a regression that caused QFile::map() to succeed or produce incorrect results when trying to map a file at an offset beyond 4 GB on 32-bit Android systems and on some special Linux configurations. Task-number: QTBUG-69148 Change-Id: I2c133120577fa12a32d444488bac3e341966f8d7 Reviewed-by: MÃ¥rten Nordheim --- tests/auto/corelib/io/largefile/tst_largefile.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/io/largefile/tst_largefile.cpp b/tests/auto/corelib/io/largefile/tst_largefile.cpp index 2d13e6166d..dca7672b8e 100644 --- a/tests/auto/corelib/io/largefile/tst_largefile.cpp +++ b/tests/auto/corelib/io/largefile/tst_largefile.cpp @@ -510,7 +510,7 @@ void tst_LargeFile::mapFile() //Mac: memory-mapping beyond EOF may succeed but it could generate bus error on access //FreeBSD: same //Linux: memory-mapping beyond EOF usually succeeds, but depends on the filesystem -// 32-bit: limited to 44-bit offsets +// 32-bit: limited to 44-bit offsets (when sizeof(off_t) == 8) //Windows: memory-mapping beyond EOF is not allowed void tst_LargeFile::mapOffsetOverflow() { @@ -521,9 +521,9 @@ void tst_LargeFile::mapOffsetOverflow() #else Succeeds = true, # if (defined(Q_OS_LINUX) || defined(Q_OS_ANDROID)) && Q_PROCESSOR_WORDSIZE == 4 - MaxOffset = 43 + MaxOffset = sizeof(QT_OFF_T) > 4 ? 43 : 30 # else - MaxOffset = 63 + MaxOffset = 8 * sizeof(QT_OFF_T) - 1 # endif #endif }; -- cgit v1.2.3