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 6.6.0 Change-Id: I512648fd617741199e67fffd1782b85935bb832a Reviewed-by: Marc Mutz <marc.mutz@qt.io>bb10
parent
eb5c5a76cf
commit
18867845eb
|
|
@ -555,7 +555,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);
|
||||
|
|
@ -564,6 +564,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…
Reference in New Issue