From 68bb724dcc878f964fd074f17b479ff92594beb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 7 Jul 2022 15:07:17 +0200 Subject: [PATCH] ErrorLogger: do not allocate huge std::string when column is -1 --- lib/errorlogger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/errorlogger.cpp b/lib/errorlogger.cpp index 294ff8708..e0c881543 100644 --- a/lib/errorlogger.cpp +++ b/lib/errorlogger.cpp @@ -489,7 +489,7 @@ static std::string readCode(const std::string &file, int linenr, int column, con std::string::size_type pos = 0; while ((pos = line.find('\t', pos)) != std::string::npos) line[pos] = ' '; - return line + endl + std::string((column>0 ? column-1 : column), ' ') + '^'; + return line + endl + std::string((column>0 ? column-1 : 0), ' ') + '^'; } static void replaceColors(std::string& source)