mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 12:23:15 +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
|
@ -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…
Reference in a new issue