Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:ahmedmoselhi2:branches:Emulators
xenia-canary
xenia_PR2212.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xenia_PR2212.patch of Package xenia-canary
From 0957b8725f7e93699e4ee1695b384104fdbb503a Mon Sep 17 00:00:00 2001 From: Adrian <78108584+AdrianCassar@users.noreply.github.com> Date: Sat, 8 Jul 2023 18:21:40 +0100 Subject: [PATCH] [BASE] Prevent crashing if special characters are in the launch path A path containing characters which cannot be converted to a multibyte string would fail and cause cxxopts to assign the cvar target to argument 0 --- src/xenia/base/main_win.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/xenia/base/main_win.cc b/src/xenia/base/main_win.cc index b6eaa4a7b4..ec20300131 100644 --- a/src/xenia/base/main_win.cc +++ b/src/xenia/base/main_win.cc @@ -96,8 +96,14 @@ bool ParseWin32LaunchArguments( char** argv = reinterpret_cast<char**>(alloca(sizeof(char*) * argc)); for (int n = 0; n < argc; n++) { size_t len = std::wcstombs(nullptr, wargv[n], 0); - argv[n] = reinterpret_cast<char*>(alloca(sizeof(char) * (len + 1))); - std::wcstombs(argv[n], wargv[n], len + 1); + + if (len != -1) { + argv[n] = reinterpret_cast<char*>(alloca(sizeof(char) * (len + 1))); + std::wcstombs(argv[n], wargv[n], len + 1); + } else { + // Prevent cxxopts from indexing out of bounds. + argc--; + } } LocalFree(wargv);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor