IPC: disallow unknown queries in QNativeIpcKey string form
So we can add them in the future but cause older versions of Qt to reject them if they don't know what they are. Pick-to: 6.6.0 Change-Id: I512648fd617741199e67fffd1782b85935bb832a Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit 18867845eb77537c4125e1da4dfcd049e303ee27) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
ef5f2322a7
commit
a5a1231d52
@ -553,7 +553,7 @@ QNativeIpcKey QNativeIpcKey::fromString(const QString &text)
|
||||
Type invalidType = {};
|
||||
Type type = stringToType(u.scheme());
|
||||
if (type == invalidType || !u.isValid() || !u.userInfo().isEmpty() || !u.host().isEmpty()
|
||||
|| u.port() != -1)
|
||||
|| u.port() != -1 || u.hasQuery())
|
||||
return QNativeIpcKey(invalidType);
|
||||
|
||||
QNativeIpcKey result(QString(), type);
|
||||
@ -562,6 +562,7 @@ QNativeIpcKey QNativeIpcKey::fromString(const QString &text)
|
||||
|
||||
// decode the payload
|
||||
result.setNativeKey(u.path());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -280,12 +280,14 @@ void tst_QNativeIpcKey::fromString_data()
|
||||
<< "posix:%C4%80.%E2%80%80.%F0%90%80%80"
|
||||
<< QNativeIpcKey(u"\u0100.\u2000.\U00010000"_s, QNativeIpcKey::Type::PosixRealtime);
|
||||
|
||||
// query and fragment are ignored
|
||||
QTest::addRow("with-query") << "posix:/foo?bar" << valid;
|
||||
// fragments are ignored
|
||||
QTest::addRow("with-fragment") << "posix:/foo#bar" << valid;
|
||||
QTest::addRow("with-queryfragment") << "posix:/foo?bar#baz" << valid;
|
||||
QTest::addRow("with-fragmentquery") << "posix:/foo#bar?baz" << valid;
|
||||
|
||||
// but unknown query items are not
|
||||
QTest::addRow("with-query") << "posix:/foo?bar" << invalid;
|
||||
QTest::addRow("with-queryfragment") << "posix:/foo?bar#baz" << invalid;
|
||||
|
||||
// add some ones that won't parse well
|
||||
QTest::addRow("positive-number") << "81" << invalid;
|
||||
QTest::addRow("negative-number") << "-81" << invalid;
|
||||
|
Loading…
x
Reference in New Issue
Block a user