Subject: [Boost-bugs] [Boost C++ Libraries] #11072: [iostreams] mapped_file::size() returns the wrong size on 32-bit windows platforms for files larger than 4gb
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-03-05 12:12:46
#11072: [iostreams] mapped_file::size() returns the wrong size on 32-bit windows
platforms for files larger than 4gb
---------------------------------------------+-----------------------
Reporter: James Whitworth <fun4jimmy@â¦> | Owner: turkanis
Type: Bugs | Status: new
Milestone: To Be Determined | Component: iostreams
Version: Boost 1.57.0 | Severity: Problem
Keywords: mapped_file size 32-bit windows |
---------------------------------------------+-----------------------
The signature is size_t mapped_file::size() which is uint32_t for 32-bit
builds. This means files larger than 4gb will return an incorrect value.
Looking at the windows implementation source for mapped_file
https://github.com/boostorg/iostreams/blob/master/src/mapped_file.cpp
around line 220. The size is queried and stored as a local boost::intmax_t
but when assigning to size_ it is static_cast to the smaller type.
I think the fix is to change the size member to be always 64-bit but I'm
not familiar enough with the rest of the library to know if this would
have any knock on effects. I suspect this is also an issue on linux as
well but I am unable to easily test that at the moment,
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11072> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC