Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/llfio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2021-02-17 22:58:44 +0300
committerNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2021-02-17 22:58:44 +0300
commit74e710643944764a3548847322d6cb9a4a7ed5ab (patch)
treebfda096d461696d3186bc6fad54e6bbcbd4255bc
parentd23bb978dbc92c3e35b210961c41e492145e022c (diff)
mapped_file_handle::read() and write() was not detecting when VA space had been exhausted, and was incorrectly segfaulting the process rather than returning errc::not_enough_memory.
-rw-r--r--include/llfio/v2.0/mapped_file_handle.hpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/llfio/v2.0/mapped_file_handle.hpp b/include/llfio/v2.0/mapped_file_handle.hpp
index 3a8246e9..44b24ec5 100644
--- a/include/llfio/v2.0/mapped_file_handle.hpp
+++ b/include/llfio/v2.0/mapped_file_handle.hpp
@@ -197,6 +197,14 @@ protected:
}
LLFIO_HEADERS_ONLY_VIRTUAL_SPEC io_result<buffers_type> _do_read(io_request<buffers_type> reqs, deadline d = deadline()) noexcept override
{
+ if(_mh.address() == nullptr)
+ {
+ OUTCOME_TRY(auto &&length, _sh.length());
+ if(length > 0)
+ {
+ return errc::not_enough_memory; // reserve() failed probably due to VMA exhaustion
+ }
+ }
return _mh.read(reqs, d);
}
LLFIO_HEADERS_ONLY_VIRTUAL_SPEC io_result<const_buffers_type> _do_write(io_request<const_buffers_type> reqs, deadline d = deadline()) noexcept override
@@ -229,6 +237,14 @@ protected:
}
return reqs.buffers;
}
+ if(_mh.address() == nullptr)
+ {
+ OUTCOME_TRY(auto &&length, _sh.length());
+ if(length > 0)
+ {
+ return errc::not_enough_memory; // reserve() failed probably due to VMA exhaustion
+ }
+ }
return _mh.write(reqs, d);
}