fix: crash on windows when UTF-8 is in path#48898
Conversation
| - bool did_original_path_start_with_resources_path = starts_with(check_path. | ||
| - generic_string(), resources_path); | ||
| + bool did_original_path_start_with_resources_path = starts_with( | ||
| + ConvertGenericPathToUTF8(check_path), resources_path); |
There was a problem hiding this comment.
Hm... I might actually need to look into how resources_path computed when strings has unicode in it.
There was a problem hiding this comment.
Nvm, it is UTF-8 for both of them so we should be good!
|
Can you move the changes to https://github.com/electron/electron/blob/main/patches/node/fix_ensure_traverseparent_bails_on_resource_path_exit.patch, it will allow for |
499ea10 to
3078e2b
Compare
|
@deepak1556 good idea. Had to reorder patches for this to make more sense sequentially. Thanks! |
In 6399527 we changed the path strings that `node_modules.cc` operates on from single-byte to wide strings. Unfortunately this means that `generic_path()` that the "fix: ensure TraverseParent bails on resource path exit" patch was calling was no longer a safe method to call on Windows if the underlying string has unicode characters in it. Here we fix it by using `ConvertGenericPathToUTF8` from the Node.js internal utilities.
3078e2b to
680e4d3
Compare
|
Release Notes Persisted
|
|
I was unable to backport this PR to "39-x-y" cleanly; |
|
I was unable to backport this PR to "38-x-y" cleanly; |
|
I have automatically backported this PR to "40-x-y", please check out #48942 |
|
Ah, manual backport here we go. |
|
@indutny-signal has manually backported this PR to "39-x-y", please check out #48944 |
|
Opened #48944 . Thank you so much! |
|
@indutny-signal has manually backported this PR to "38-x-y", please check out #48947 |
In 6399527 we changed the path strings that `node_modules.cc` operates on from single-byte to wide strings. Unfortunately this means that `generic_path()` that the "fix: ensure TraverseParent bails on resource path exit" patch was calling was no longer a safe method to call on Windows if the underlying string has unicode characters in it. Here we fix it by using `ConvertGenericPathToUTF8` from the Node.js internal utilities.
In 6399527 we changed the path strings that `node_modules.cc` operates on from single-byte to wide strings. Unfortunately this means that `generic_path()` that the "fix: ensure TraverseParent bails on resource path exit" patch was calling was no longer a safe method to call on Windows if the underlying string has unicode characters in it. Here we fix it by using `ConvertGenericPathToUTF8` from the Node.js internal utilities.
In 6399527 we changed the path strings that `node_modules.cc` operates on from single-byte to wide strings. Unfortunately this means that `generic_path()` that the "fix: ensure TraverseParent bails on resource path exit" patch was calling was no longer a safe method to call on Windows if the underlying string has unicode characters in it. Here we fix it by using `ConvertGenericPathToUTF8` from the Node.js internal utilities.
Description of Change
In 6399527 we changed the path strings that
node_modules.ccoperates on from single-byte to wide strings. Unfortunately this means thatgeneric_path()that the "fix: ensure TraverseParent bails on resource path exit" patch was calling was no longer a safe method to call on Windows if the underlying string has unicode characters in it.Here we fix it by using
ConvertGenericPathToUTF8from the Node.js internal utilities.cc @codebytere @deepak1556 @VerteDinde
Checklist
npm testpassesRelease Notes
Notes: fix crash on windows when UTF-8 is in path