Skip to content

QFSFileEngine: fix overflow bug when using lseek64

QT_LSEEK (lseek64()) returns QT_OFF_T, which is off64_t on 32bit systems. The return from the lseek64() call was being assigned to an int, which meant that if the returned value is > INT_MAX it will overflow and the value becomes -1, and since errno would be EOVERFLOW the code would fail to open the file.

Fix the issue by assigning the return value to QT_OFF_T.

Thanks to Giuseppe for pointing out the issue in the code review.

Found by compiling with -Wshorten-64-to-32.

[ChangeLog][QtCore][QFile] Fixed a bug where opening a file in append mode may fail if the file size was bigger than INT_MAX.

Pick-to: 6.5 6.4 6.2 5.15 Change-Id: Iad33e3192f37466643a1218d38e5ecc2baaa7dc9 Reviewed-by: Thiago Macieira thiago.macieira@intel.com (cherry picked from commit 5bffb47d)

Merge request reports