added new filtration and fixed processing parameters
This commit is contained in:
@@ -188,7 +188,7 @@ auto ShmRing::open_or_create(
|
||||
const bool geometry_ok = header->capacity == capacity && header->slot_size_bytes == slot_size_bytes;
|
||||
|
||||
if (magic_ok && version_ok && geometry_ok) {
|
||||
// Fix #50: the requested mapped_size matched the header geometry, but the
|
||||
// the requested mapped_size matched the header geometry, but the
|
||||
// backing file may have been created undersized by another process. Confirm
|
||||
// st_size covers the geometry before trusting the mapping.
|
||||
struct stat info {};
|
||||
@@ -257,7 +257,7 @@ auto ShmRing::open_existing(const std::string& name) -> ShmRing {
|
||||
if (header->version != kRingVersion) {
|
||||
throw std::runtime_error("Shared memory ring version mismatch for " + name);
|
||||
}
|
||||
// Fix #50: ensure the mapping actually spans every slot the header describes.
|
||||
// ensure the mapping actually spans every slot the header describes.
|
||||
validate_geometry(*header, mapped_size, name);
|
||||
|
||||
ShmRing ring{};
|
||||
@@ -411,7 +411,7 @@ void ShmRing::validate_name(const std::string& name) {
|
||||
}
|
||||
|
||||
void ShmRing::validate_geometry(const Header& header, std::size_t mapped_size, const std::string& name) {
|
||||
// Fix #50: derive the expected size from the header's own geometry fields and
|
||||
// derive the expected size from the header's own geometry fields and
|
||||
// require the real mapping to cover it. A bogus capacity/slot_size or a truncated
|
||||
// mapping would otherwise yield out-of-bounds slot offsets and a SIGSEGV.
|
||||
const std::uint32_t capacity = header.capacity;
|
||||
|
||||
Reference in New Issue
Block a user