1
0
Fork 0

ASan: QtMessageContext doesn’t copy file names

Use the ‘file name copying’ version of log(), to avoid an ASan use-
after-free. Note this requires SG change 
 908496d43dd7c3a7ca1de42b0e0c21aa0498c7df
to work correctly.
This commit is contained in:
James Turner 2020-09-05 10:44:21 +01:00
parent c9d1d58146
commit f802e09c57

View file

@ -223,7 +223,9 @@ static void simgearMessageOutput(QtMsgType type, const QMessageLogContext &conte
static const char* nullFile = "";
const char* file = context.file ? context.file : nullFile;
sglog().log(SG_GUI, mappedPriority, file, context.line, msg.toStdString());
const auto s = msg.toStdString();
// important we copy the file name here, since QMessageLogContext doesn't
sglog().logCopyingFilename(SG_GUI, mappedPriority, file, context.line, s);
if (type == QtFatalMsg) {
abort();
}