8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 18:43:02 +01:00

Added check for correct version of shared memory used in MappingIpc.

This commit is contained in:
hvlad 2021-03-14 01:58:55 +02:00
parent 45bdd2ed5a
commit 60ea1d2d33

View File

@ -784,13 +784,24 @@ public:
iscLogException("MappingIpc: Cannot initialize the shared memory region", ex);
throw;
}
fb_assert(sharedMemory->getHeader()->mhb_header_version == MemoryHeader::HEADER_VERSION);
fb_assert(sharedMemory->getHeader()->mhb_version == MAPPING_VERSION);
Guard gShared(this);
MappingHeader* sMem = sharedMemory->getHeader();
if (sMem->mhb_type != SharedMemoryBase::SRAM_MAPPING_RESET ||
sMem->mhb_header_version != MemoryHeader::HEADER_VERSION ||
sMem->mhb_version != MAPPING_VERSION)
{
string err;
err.printf("MappingIpc: inconsistent shared memory type/version; found %d/%d:%d, expected %d/%d:%d",
sMem->mhb_type, sMem->mhb_header_version, sMem->mhb_version,
SharedMemoryBase::SRAM_MAPPING_RESET, MemoryHeader::HEADER_VERSION, MAPPING_VERSION);
sharedMemory = NULL;
(Arg::Gds(isc_random) << Arg::Str(err)).raise();
}
Guard gShared(this);
for (process = 0; process < sMem->processes; ++process)
{
if (!(sMem->process[process].flags & MappingHeader::FLAG_ACTIVE))