xcb: check for nullptr when reading AT_SPI_BUS property
We always have to check the return value of xcb_get_property(), but this code did not do it. These xcb functions do not check for validity of the pointer, so we have to make sure that we pass-in something valid: void * xcb_get_property_value (const xcb_get_property_reply_t *R) { return (void *) (R + 1); } int xcb_get_property_value_length (const xcb_get_property_reply_t *R) { return (R->value_len * (R->format / 8)); } Fixes: QTBUG-74067 Change-Id: Iabbc81e6079d96c7314d16dd78783de07f9ad629 Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
This commit is contained in:
parent
e8d3306c8f
commit
856fb1ab44
@ -412,12 +412,15 @@ void *QXcbNativeInterface::atspiBus()
|
||||
auto reply = Q_XCB_REPLY(xcb_get_property, defaultConnection->xcb_connection(),
|
||||
false, defaultConnection->rootWindow(),
|
||||
atspiBusAtom, XCB_ATOM_STRING, 0, 128);
|
||||
Q_ASSERT(!reply->bytes_after);
|
||||
if (!reply)
|
||||
return nullptr;
|
||||
|
||||
char *data = (char *)xcb_get_property_value(reply.get());
|
||||
int length = xcb_get_property_value_length(reply.get());
|
||||
return new QByteArray(data, length);
|
||||
}
|
||||
return 0;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void QXcbNativeInterface::setAppTime(QScreen* screen, xcb_timestamp_t time)
|
||||
|
Loading…
Reference in New Issue
Block a user