You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Between 0.46.0-beta1 and 0.46.0 a change to Windows parsing of "chromium-args" in package.json truncates it to a length of MAX_PATH (260 characters).
#7670
Open
sirisian opened this issue
Feb 4, 2021
· 3 comments
(I know some of those flags are no longer valid, just an example).
Actual behavior
The "chromium-args" truncates and only seems to process the first 260 characters silently ignoring the rest. This can cause very unexpected and subtle bugs when upgrading past 0.46.0-beta1.
How to reproduce
Add in a bunch of flags like I have and it'll ignore the ones after 260 characters.
Refer to the changes made to "src/nw_package.cc" in this diff:
The following code was added that I think caused this:
// Expand Windows psudovars (ex; %APPDATA%) passed in chromium-args in the same way as when // passed as command line parameters.
#if defined(OS_WIN)
TCHAR szEnvPath[MAX_PATH];
std::wstring ws;
ws.assign( args.begin(), args.end());
if (ExpandEnvironmentStrings(ws.c_str(), szEnvPath,MAX_PATH) != 0) {
std::wstring ws_out = szEnvPath;
args = std::string(ws_out.begin(), ws_out.end());
} else {
ReportError("Failed to expand chromium args",args.c_str());
}
#endif
One could just naively replace MAX_PATH to a larger number like 10000 or correctly handle this by growing an array with the value returned by ExpandEnvironmentStrings?
The text was updated successfully, but these errors were encountered:
@sirisian I looked at the PR related to this. Should we instead have a flag which dynamically sets the character limit higher than 260 with an upper limit of 32,000? Let's say the user's chromium-args character length is 268 which is only 8 above the limit. It probably wouldn't make sense to allocate all that extra memory if it isn't going to be used (forgive me if I misunderstood the way memory is handled)? Or we could instead keep the limit of 260 characters and add a note about it in the documentation.
It would be great to increase it dynamically as many use nw.js for games or other GPU and media related things. There are many Chromium args that support this type of use case. Now if it stays at a size of 260, that would be extremely obstructive.
NWJS Version : 0.46.0+
Operating System: Only Windows
Expected behavior
"chromium-args" of any length should be parsed.
(I know some of those flags are no longer valid, just an example).
Actual behavior
The "chromium-args" truncates and only seems to process the first 260 characters silently ignoring the rest. This can cause very unexpected and subtle bugs when upgrading past 0.46.0-beta1.
How to reproduce
Add in a bunch of flags like I have and it'll ignore the ones after 260 characters.
Refer to the changes made to "src/nw_package.cc" in this diff:
nw-v0.46.0-beta1...nw-v0.46.0
The following code was added that I think caused this:
One could just naively replace MAX_PATH to a larger number like 10000 or correctly handle this by growing an array with the value returned by ExpandEnvironmentStrings?
The text was updated successfully, but these errors were encountered: