a11y atspi: Ignore malformed text attr instead of crashing

If the attribute does not follow the required
"name:value" syntax, ignore it, rather than crashing
if it doesn't contain any colon.

Same issue as spotted by Jan Arve Sæther during the review
of a QTBUG-118106 related change that would have introduced
the same issue in UIA code.

Pick-to: 6.5
Change-Id: Id391502ed7aec7f09ef2826a456f2e4737af045e
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit b0bcf475694114bf503167bd11f14647880cd6b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Michael Weghorn 2023-11-14 23:31:45 +01:00 committed by Qt Cherry-pick Bot
parent 5e5e5911e0
commit d79e52be22

View File

@ -2261,11 +2261,13 @@ QVariantList AtSpiAdaptor::getAttributes(QAccessibleInterface *interface, int of
QString joined = interface->textInterface()->attributes(offset, &startOffset, &endOffset);
const QStringList attributes = joined.split(u';', Qt::SkipEmptyParts, Qt::CaseSensitive);
for (const QString &attr : attributes) {
QStringList items;
items = attr.split(u':', Qt::SkipEmptyParts, Qt::CaseSensitive);
AtSpiAttribute attribute = atspiTextAttribute(items[0], items[1]);
if (!attribute.isNull())
set[attribute.name] = attribute.value;
QStringList items = attr.split(u':', Qt::SkipEmptyParts, Qt::CaseSensitive);
if (items.count() == 2)
{
AtSpiAttribute attribute = atspiTextAttribute(items[0], items[1]);
if (!attribute.isNull())
set[attribute.name] = attribute.value;
}
}
QVariantList list;