mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-06 17:48:37 +00:00
LibGLSL: Avoid UAF when creating a preprocessor instance
The intialization of Definition::value allocates a string that we were holding a view into. Store the result as a String to keep it alive; its only usage is passing it to GenericLexer in another function.
This commit is contained in:
parent
3dee703227
commit
decc00dcdf
Notes:
sideshowbarker
2024-07-16 23:34:44 +09:00
Author: https://github.com/trflynn89
Commit: decc00dcdf
Pull-request: https://github.com/SerenityOS/serenity/pull/23830
Reviewed-by: https://github.com/shannonbooth ✅
2 changed files with 2 additions and 2 deletions
|
@ -366,7 +366,7 @@ ErrorOr<Optional<Preprocessor::Definition>> Preprocessor::create_definition(Stri
|
|||
}
|
||||
|
||||
if (token_index < tokens.size())
|
||||
definition.value = TRY(remove_escaped_newlines(line.substring_view(tokens[token_index].start().column))).bytes_as_string_view();
|
||||
definition.value = TRY(remove_escaped_newlines(line.substring_view(tokens[token_index].start().column)));
|
||||
|
||||
return definition;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
struct Definition {
|
||||
StringView key;
|
||||
Vector<StringView> parameters;
|
||||
StringView value;
|
||||
String value;
|
||||
FlyString filename;
|
||||
size_t line { 0 };
|
||||
size_t column { 0 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue