[+] IProcessSectionView::MapIPCMemory now takes a 'length' parameter
This commit is contained in:
parent
f98174b7a2
commit
51facdb6a3
@ -29,6 +29,7 @@ namespace Aurora::Process
|
||||
|
||||
virtual AuSPtr<IProcessSectionMapView> MapIPCMemory(const AuString &handle,
|
||||
AuUInt64 offset,
|
||||
AuUInt64 length,
|
||||
Aurora::IO::FS::EFileOpenMode mode) = 0;
|
||||
};
|
||||
|
||||
|
@ -176,6 +176,7 @@ namespace Aurora::Process
|
||||
|
||||
AuSPtr<IProcessSectionMapView> ProcessSectionView::MapIPCMemory(const AuString &handleString,
|
||||
AuUInt64 offset,
|
||||
AuUInt64 length,
|
||||
AuFS::EFileOpenMode mode)
|
||||
{
|
||||
AuIPC::IPCHandle handle;
|
||||
@ -195,8 +196,14 @@ namespace Aurora::Process
|
||||
return {};
|
||||
}
|
||||
|
||||
auto length = token->token.word;
|
||||
auto path = token->token.ToNTPath();
|
||||
auto actualLength = token->token.word;
|
||||
auto path = token->token.ToNTPath();
|
||||
|
||||
if (actualLength < offset + length)
|
||||
{
|
||||
SysPushErrorIO("Out of range");
|
||||
return {};
|
||||
}
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
|
@ -27,6 +27,7 @@ namespace Aurora::Process
|
||||
|
||||
AuSPtr<IProcessSectionMapView> MapIPCMemory(const AuString &handle,
|
||||
AuUInt64 offset,
|
||||
AuUInt64 length,
|
||||
AuFS::EFileOpenMode mode) override;
|
||||
|
||||
};
|
||||
|
@ -115,6 +115,7 @@ namespace Aurora::Process
|
||||
|
||||
AuSPtr<IProcessSectionMapView> ProcessSectionView::MapIPCMemory(const AuString &handleString,
|
||||
AuUInt64 offset,
|
||||
AuUInt64 length,
|
||||
AuFS::EFileOpenMode mode)
|
||||
{
|
||||
AuIPC::IPCHandle handle;
|
||||
@ -132,7 +133,15 @@ namespace Aurora::Process
|
||||
return {};
|
||||
}
|
||||
|
||||
auto path = AuIPC::GetServerPath(val->token);
|
||||
auto actualLength = val->token.word;
|
||||
auto path = AuIPC::GetServerPath(val->token);
|
||||
|
||||
if (actualLength < offset + length)
|
||||
{
|
||||
SysPushErrorIO("Out of range");
|
||||
return {};
|
||||
}
|
||||
|
||||
int fd = ::shm_open(path.c_str(), O_RDWR, S_IRUSR | S_IWUSR);
|
||||
if (fd == -1)
|
||||
{
|
||||
@ -140,6 +149,8 @@ namespace Aurora::Process
|
||||
return {};
|
||||
}
|
||||
|
||||
// TODO (Reece): lock garbage ( ??? )
|
||||
|
||||
int prot {};
|
||||
switch (mode)
|
||||
{
|
||||
|
@ -27,6 +27,7 @@ namespace Aurora::Process
|
||||
|
||||
AuSPtr<IProcessSectionMapView> MapIPCMemory(const AuString &handle,
|
||||
AuUInt64 offset,
|
||||
AuUInt64 length,
|
||||
AuFS::EFileOpenMode mode) override;
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user