From f303bf9c665dc358ace90364e772a3c93d6022f0 Mon Sep 17 00:00:00 2001 From: firewave Date: Thu, 26 Feb 2026 16:26:47 +0100 Subject: [PATCH] refs #3452 - assert on unprintable characters in error messages [skip ci] --- lib/errorlogger.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/errorlogger.cpp b/lib/errorlogger.cpp index 13f66c13d1a..5231aca2955 100644 --- a/lib/errorlogger.cpp +++ b/lib/errorlogger.cpp @@ -226,6 +226,10 @@ void ErrorMessage::setmsg(const std::string &msg) // Even this doesn't cause problems with messages that have multiple // lines, none of the error messages should end into it. assert(!endsWith(msg,'\n')); + // bailout on any unprintable characters + assert(std::all_of(msg.cbegin(), msg.cend(), [](char c){ + return std::isprint(c) || c == '\n'; + })); // The summary and verbose message are separated by a newline // If there is no newline then both the summary and verbose messages