diff options
author | Lioncash <[email protected]> | 2022-12-05 21:26:00 -0500 |
---|---|---|
committer | Lioncash <[email protected]> | 2022-12-05 21:31:34 -0500 |
commit | e7f9f58fa408ac89ed1ce709494d84090b63bff0 (patch) | |
tree | fb5caf9dc17fe8639d5a9138727f1adf3c8961fc /src/core/reporter.h | |
parent | 3b19f741bd6a19f603858e6cdf8db41516c7075f (diff) | |
download | yuzu-android-e7f9f58fa408ac89ed1ce709494d84090b63bff0.tar.gz yuzu-android-e7f9f58fa408ac89ed1ce709494d84090b63bff0.zip |
reporter: Eliminate undefined behavior in SaveErrorReport
The optionals are unconditionally dereferenced when setting the custom
error text, and in a few cases this function is called using the default
value of the optionals.
This means we'd be dereferencing uninitialized storage.
Since they're used unconditionally, we can use value_or to set a default
when storage is uninitialized.
Diffstat (limited to 'src/core/reporter.h')
-rw-r--r-- | src/core/reporter.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/reporter.h b/src/core/reporter.h index 68755cbde..983a9545a 100644 --- a/src/core/reporter.h +++ b/src/core/reporter.h @@ -61,8 +61,8 @@ public: // Used by error applet void SaveErrorReport(u64 title_id, Result result, - std::optional<std::string> custom_text_main = {}, - std::optional<std::string> custom_text_detail = {}) const; + const std::optional<std::string>& custom_text_main = {}, + const std::optional<std::string>& custom_text_detail = {}) const; void SaveFSAccessLog(std::string_view log_message) const; |