mirror of
https://github.com/boostorg/interprocess.git
synced 2026-01-19 04:12:13 +00:00
Fixes issue #89 ("priv_size_from_mapping_size() calculates wrong value")
This commit is contained in:
@@ -297,7 +297,7 @@ inline bool mapped_region::priv_flush_param_check
|
||||
if(m_base == 0)
|
||||
return false;
|
||||
|
||||
if(mapping_offset >= m_size || (mapping_offset + numbytes) > m_size){
|
||||
if(mapping_offset >= m_size || numbytes > (m_size - size_t(mapping_offset))){
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -346,14 +346,14 @@ inline void mapped_region::priv_size_from_mapping_size
|
||||
(offset_t mapping_size, offset_t offset, offset_t page_offset, std::size_t &size)
|
||||
{
|
||||
//Check if mapping size fits in the user address space
|
||||
//as offset_t is the maximum file size and its signed.
|
||||
//as offset_t is the maximum file size and it's signed.
|
||||
if(mapping_size < offset ||
|
||||
boost::uintmax_t(mapping_size - (offset - page_offset)) >
|
||||
boost::uintmax_t(std::size_t(-1))){
|
||||
error_info err(size_error);
|
||||
throw interprocess_exception(err);
|
||||
}
|
||||
size = static_cast<std::size_t>(mapping_size - (offset - page_offset));
|
||||
size = static_cast<std::size_t>(mapping_size - offset);
|
||||
}
|
||||
|
||||
inline offset_t mapped_region::priv_page_offset_addr_fixup(offset_t offset, const void *&address)
|
||||
|
||||
Reference in New Issue
Block a user