fix raw data leak in $$absolute_path()
when the file name is empty, the path will be returned verbatim. this must be considered when constructing the return value. Task-number: QTBUG-54550 Change-Id: Ie108ed52275e66a154ef63bd6f7193f55b3e0454 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
d459a6b0e0
commit
3c8134958c
@ -1027,7 +1027,11 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
|
|||||||
QString rstr = QDir::cleanPath(
|
QString rstr = QDir::cleanPath(
|
||||||
QDir(args.count() > 1 ? args.at(1).toQString(m_tmp2) : currentDirectory())
|
QDir(args.count() > 1 ? args.at(1).toQString(m_tmp2) : currentDirectory())
|
||||||
.absoluteFilePath(args.at(0).toQString(m_tmp1)));
|
.absoluteFilePath(args.at(0).toQString(m_tmp1)));
|
||||||
ret << (rstr.isSharedWith(m_tmp1) ? args.at(0) : ProString(rstr).setSource(args.at(0)));
|
ret << (rstr.isSharedWith(m_tmp1)
|
||||||
|
? args.at(0)
|
||||||
|
: args.count() > 1 && rstr.isSharedWith(m_tmp2)
|
||||||
|
? args.at(1)
|
||||||
|
: ProString(rstr).setSource(args.at(0)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case E_RELATIVE_PATH:
|
case E_RELATIVE_PATH:
|
||||||
|
@ -2482,6 +2482,14 @@ void tst_qmakelib::proEval_data()
|
|||||||
"Project MESSAGE: assign split joined: word: this is a test:done\n"
|
"Project MESSAGE: assign split joined: word: this is a test:done\n"
|
||||||
"Project MESSAGE: assign split quoted: word this is a test done"
|
"Project MESSAGE: assign split quoted: word this is a test done"
|
||||||
<< true;
|
<< true;
|
||||||
|
|
||||||
|
// Raw data leak with empty file name. Verify with Valgrind or asan.
|
||||||
|
QTest::newRow("QTBUG-54550")
|
||||||
|
<< "FULL = /there/is\n"
|
||||||
|
"VAR = $$absolute_path(, $$FULL/nothing/here/really)"
|
||||||
|
<< "VAR = /there/is/nothing/here/really"
|
||||||
|
<< ""
|
||||||
|
<< true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString formatValue(const ProStringList &vals)
|
static QString formatValue(const ProStringList &vals)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user