mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-22 15:44:45 +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:
committed by
Andreas Kling
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 };
|
||||
|
||||
Reference in New Issue
Block a user