[Symbolizer] Fix use-after-free

MarkupFilter keeps a reference to the last filtered StringRef. Just keep
it alive a bit longer. Found by asan.
This commit is contained in:
Benjamin Kramer
2022-07-22 10:28:25 +02:00
parent 242316bc27
commit fc99f18a20

View File

@@ -368,7 +368,8 @@ static SmallVector<uint8_t> parseBuildIDArg(const opt::InputArgList &Args,
// Symbolize markup from stdin and write the result to stdout.
static void filterMarkup(const opt::InputArgList &Args) {
MarkupFilter Filter(outs(), parseColorArg(Args));
for (std::string InputString; std::getline(std::cin, InputString);) {
std::string InputString;
while (std::getline(std::cin, InputString)) {
InputString += '\n';
Filter.filter(InputString);
}