diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2023-08-15 10:30:44 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2023-08-15 17:48:43 +0200 |
commit | f6735dba9518ffc896541f212fade350e18c91de (patch) | |
tree | 747b22fbd78c504b2d05acbbe90c849bf62e0d1a /src/qml/qml/qqml.cpp | |
parent | afb57dfa06fb7e8be47ac1118758421cfe31ba3e (diff) |
QmlCompiler: Fix console logging
Store a copy of the UTF-8 data for file and function so that we don't
run into heap-use-after-free.
Set the instruction pointer before calling the log function so that we
get a correct line number.
Pick-to: 6.6 6.5
Fixes: QTBUG-114655
Change-Id: I38249fe52719ddad620033716ff22b2087ab8382
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqml.cpp')
-rw-r--r-- | src/qml/qml/qqml.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/qml/qml/qqml.cpp b/src/qml/qml/qqml.cpp index f951fb6a14..1e051fd37a 100644 --- a/src/qml/qml/qqml.cpp +++ b/src/qml/qml/qqml.cpp @@ -1472,8 +1472,10 @@ void AOTCompiledContext::writeToConsole( const QV4::CppStackFrame *frame = engine->handle()->currentStackFrame; Q_ASSERT(frame); - QMessageLogger logger(qUtf8Printable(frame->source()), frame->lineNumber(), - qUtf8Printable(frame->function()), loggingCategory->categoryName()); + const QByteArray source(frame->source().toUtf8()); + const QByteArray function(frame->function().toUtf8()); + QMessageLogger logger(source.constData(), frame->lineNumber(), + function.constData(), loggingCategory->categoryName()); switch (type) { case QtDebugMsg: |