[bug report]boost-sandbox.interprocess::mapped_region.hpp

Hi, Because of network problem, what I had is a snapshot of CVS-HEAD-07-06-29-0909. If this bug is corrected/reported before, please ignore. in the file /boost/interprocess/mapped_region.hpp line 467, followed is a snip ============================================== //Check for fixed mapping error if(address && (m_base != (void*)address)){ error_info err = system_error_code(); this->priv_close(); // bug here throw interprocess_exception(err); } ============================================== because adjusting mapping address to page size granularity, which may cause m_extra_offset != 0. in mapped_region::priv_close::munmap will restore address with m_base and m_extra_offset. But at line 467, m_base did not be adjusted (it's adjusted at line 472), when priv_close() invoked, we got a wrong address to munmap. I think it affect windows version too (same file at line 309). one possible correction: move line 472~474 to 463 (*nix version). move line 314 to 305 (windows version). Best Regards, Wilbur Lang

Wilbur Lang wrote:
Hi,
Because of network problem, what I had is a snapshot of CVS-HEAD-07-06-29-0909. If this bug is corrected/reported before, please ignore.
in the file /boost/interprocess/mapped_region.hpp line 467, followed is a snip [...]
You are right. If the mapping address is not the desired one, the cleanup is wrong. Your solution, moving the following lines
============================================== //Check for fixed mapping error if(address && (m_base != (void*)address)){ error_info err = system_error_code(); this->priv_close(); // bug here throw interprocess_exception(err); } ==============================================
to the end of the function should fix it (since the object would be in an stable state)
I think it affect windows version too (same file at line 309).
In windows, if the suggested address can't be exactly achieved, the mapping fails, so you don't need to check the mapping address. I've already changed HEAD. Thanks for the report, Ion
participants (2)
-
Ion Gaztañaga
-
Wilbur Lang