devoptab: add workaround for dkp nullptr bug.
manually set the array at startup to avoid nullptr access.
This commit is contained in:
@@ -32,4 +32,8 @@ Result GetNetworkDevices(location::StdioEntries& out);
|
|||||||
void UmountAllNeworkDevices();
|
void UmountAllNeworkDevices();
|
||||||
void UmountNeworkDevice(const fs::FsPath& mount);
|
void UmountNeworkDevice(const fs::FsPath& mount);
|
||||||
|
|
||||||
|
// manually set the array so that we can avoid nullptr access.
|
||||||
|
// SEE: https://github.com/devkitPro/newlib/issues/35
|
||||||
|
void FixDkpBug();
|
||||||
|
|
||||||
} // namespace sphaira::devoptab
|
} // namespace sphaira::devoptab
|
||||||
|
|||||||
@@ -1567,6 +1567,8 @@ App::App(const char* argv0) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
devoptab::FixDkpBug();
|
||||||
|
|
||||||
#ifdef ENABLE_LIBHAZE
|
#ifdef ENABLE_LIBHAZE
|
||||||
if (App::GetMtpEnable()) {
|
if (App::GetMtpEnable()) {
|
||||||
SCOPED_TIMESTAMP("mtp init");
|
SCOPED_TIMESTAMP("mtp init");
|
||||||
|
|||||||
@@ -11,6 +11,11 @@
|
|||||||
#include <minIni.h>
|
#include <minIni.h>
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
|
||||||
|
// see FixDkpBug();
|
||||||
|
extern "C" {
|
||||||
|
extern const devoptab_t dotab_stdnull;
|
||||||
|
}
|
||||||
|
|
||||||
namespace sphaira::devoptab::common {
|
namespace sphaira::devoptab::common {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -1544,4 +1549,15 @@ void UmountNeworkDevice(const fs::FsPath& mount) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FixDkpBug() {
|
||||||
|
const int max = 35;
|
||||||
|
|
||||||
|
for (int i = 0; i < max; i++) {
|
||||||
|
if (!devoptab_list[i]) {
|
||||||
|
devoptab_list[i] = &dotab_stdnull;
|
||||||
|
log_write("[DEVOPTAB] Fixing DKP bug at index: %d\n", i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // sphaira::devoptab
|
} // sphaira::devoptab
|
||||||
|
|||||||
Reference in New Issue
Block a user