mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-17 14:08:30 +00:00
Fix UB of loading modules
- The lambda here infers its return type as `std::string`, and since `info` is `const`, the labmda copies `info.name` and returns a `std::string&&`. After captured by the `std::string_view`, the `std::string&&` return value deconstructs and makes `std::string_view` refers to a dangling pointer.
This commit is contained in:
parent
d0fc372ecd
commit
e184eb4a23
@ -753,7 +753,7 @@ void remove_modules() {
|
||||
void exec_module_scripts(const char *stage) {
|
||||
vector<string_view> module_names;
|
||||
std::transform(modules->begin(), modules->end(), std::back_inserter(module_names),
|
||||
[](const module_info &info) { return info.name; });
|
||||
[](const module_info &info) -> string_view { return info.name; });
|
||||
exec_module_scripts(stage, module_names);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user