fix possible crash in case null pointer is passed to QCryptographicHash::addData()

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-03-12 00:34:27 +02:00
parent f1bbf0c42e
commit c228fd6100

View file

@ -165,11 +165,9 @@ void QCryptographicHash::addData(const char *data, int length)
*/
bool QCryptographicHash::addData(QIODevice* device)
{
if (!device->isReadable())
return false;
if (!device->isOpen())
if (!device || !device->isReadable() || !device->isOpen()) {
return false;
}
QSTACKARRAY(char, buffer, QT_BUFFSIZE);
int length;