mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2026-06-05 19:56:57 +00:00
Merge pull request #2763 from masagrator/patch-1
Fix off by 1 bug + allocation error + missing initialize in PGL
This commit is contained in:
commit
c8d68a3a8a
@ -75,15 +75,15 @@ namespace ams::pgl::srv {
|
|||||||
NON_COPYABLE(HostPackageReader);
|
NON_COPYABLE(HostPackageReader);
|
||||||
NON_MOVEABLE(HostPackageReader);
|
NON_MOVEABLE(HostPackageReader);
|
||||||
private:
|
private:
|
||||||
char m_content_path[fs::EntryNameLengthMax] = {};
|
char m_content_path[fs::EntryNameLengthMax] = {};
|
||||||
ExtensionType m_extension_type = ExtensionType::None;
|
ExtensionType m_extension_type = ExtensionType::None;
|
||||||
char m_mount_name[fs::MountNameLengthMax] = {};
|
char m_mount_name[fs::MountNameLengthMax + 1] = {};
|
||||||
bool m_is_mounted = false;
|
bool m_is_mounted = false;
|
||||||
ncm::AutoBuffer m_content_meta_buffer;
|
ncm::AutoBuffer m_content_meta_buffer;
|
||||||
ncm::ProgramId m_program_id = ncm::InvalidProgramId;
|
ncm::ProgramId m_program_id = ncm::InvalidProgramId;
|
||||||
u32 m_program_version = 0;
|
u32 m_program_version = 0;
|
||||||
ncm::ContentMetaType m_content_meta_type = static_cast<ncm::ContentMetaType>(0);
|
ncm::ContentMetaType m_content_meta_type = static_cast<ncm::ContentMetaType>(0);
|
||||||
u8 m_program_index = 0;
|
u8 m_program_index = 0;
|
||||||
public:
|
public:
|
||||||
HostPackageReader() : m_content_meta_buffer() { /* ... */ }
|
HostPackageReader() : m_content_meta_buffer() { /* ... */ }
|
||||||
~HostPackageReader() {
|
~HostPackageReader() {
|
||||||
|
|||||||
@ -37,6 +37,7 @@ namespace ams {
|
|||||||
R_ABORT_UNLESS(pmshellInitialize());
|
R_ABORT_UNLESS(pmshellInitialize());
|
||||||
R_ABORT_UNLESS(ldrShellInitialize());
|
R_ABORT_UNLESS(ldrShellInitialize());
|
||||||
R_ABORT_UNLESS(lrInitialize());
|
R_ABORT_UNLESS(lrInitialize());
|
||||||
|
lr::Initialize();
|
||||||
|
|
||||||
/* Verify that we can sanely execute. */
|
/* Verify that we can sanely execute. */
|
||||||
ams::CheckApiVersion();
|
ams::CheckApiVersion();
|
||||||
@ -58,3 +59,36 @@ namespace ams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Override operator new. */
|
||||||
|
void *operator new(size_t size) {
|
||||||
|
return ams::pgl::srv::Allocate(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *operator new(size_t size, const std::nothrow_t &) {
|
||||||
|
return ams::pgl::srv::Allocate(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void *p) {
|
||||||
|
return ams::pgl::srv::Deallocate(p, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void *p, size_t size) {
|
||||||
|
return ams::pgl::srv::Deallocate(p, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *operator new[](size_t size) {
|
||||||
|
return ams::pgl::srv::Allocate(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *operator new[](size_t size, const std::nothrow_t &) {
|
||||||
|
return ams::pgl::srv::Allocate(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete[](void *p) {
|
||||||
|
return ams::pgl::srv::Deallocate(p, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete[](void *p, size_t size) {
|
||||||
|
return ams::pgl::srv::Deallocate(p, size);
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user