From 50661a9558ca3fe93bf569cc572b0fb2def5589d Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 9 Jul 2020 13:30:03 +0200 Subject: Change QByteArray to handle large arrays Use qsizetype throughout. Change-Id: I787af7fcfa17e1be87decb64c41c609cc24be117 Reviewed-by: Qt CI Bot Reviewed-by: Lars Knoll Reviewed-by: Oliver Wolff Reviewed-by: Thiago Macieira --- src/plugins/generic/tuiotouch/qoscbundle.cpp | 4 ++-- src/plugins/generic/tuiotouch/qoscmessage.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/plugins/generic/tuiotouch') diff --git a/src/plugins/generic/tuiotouch/qoscbundle.cpp b/src/plugins/generic/tuiotouch/qoscbundle.cpp index e9166922a1..355747db6a 100644 --- a/src/plugins/generic/tuiotouch/qoscbundle.cpp +++ b/src/plugins/generic/tuiotouch/qoscbundle.cpp @@ -80,7 +80,7 @@ QOscBundle::QOscBundle(const QByteArray &data) // "followed by an OSC Time // Tag, followed by zero or more OSC Bundle Elements. The OSC-timetag is a // 64-bit fixed point time tag whose semantics are described below." - if (parsedBytes > (quint32)data.size() || data.size() - parsedBytes < sizeof(quint64)) + if (parsedBytes > (quint32)data.size() || data.size() - parsedBytes < qsizetype(sizeof(quint64))) return; // "Time tags are represented by a 64 bit fixed point number. The first 32 @@ -113,7 +113,7 @@ QOscBundle::QOscBundle(const QByteArray &data) // // in practice, a bundle can contain multiple bundles or messages, // though, and each is prefixed by a size. - if (data.size() - parsedBytes < sizeof(quint32)) + if (data.size() - parsedBytes < qsizetype(sizeof(quint32))) return; quint32 size = qFromBigEndian((const uchar*)data.constData() + parsedBytes); diff --git a/src/plugins/generic/tuiotouch/qoscmessage.cpp b/src/plugins/generic/tuiotouch/qoscmessage.cpp index dba0decf51..ef2f8a6ae9 100644 --- a/src/plugins/generic/tuiotouch/qoscmessage.cpp +++ b/src/plugins/generic/tuiotouch/qoscmessage.cpp @@ -92,7 +92,7 @@ QOscMessage::QOscMessage(const QByteArray &data) return; arguments.append(aString); } else if (typeTag == 'i') { // int32 - if (parsedBytes > (quint32)data.size() || data.size() - parsedBytes < sizeof(quint32)) + if (parsedBytes > (quint32)data.size() || data.size() - parsedBytes < qsizetype(sizeof(quint32))) return; quint32 anInt = qFromBigEndian(data.constData() + parsedBytes); @@ -101,7 +101,7 @@ QOscMessage::QOscMessage(const QByteArray &data) // TODO: is int32 in OSC signed, or unsigned? arguments.append((int)anInt); } else if (typeTag == 'f') { // float32 - if (parsedBytes > (quint32)data.size() || data.size() - parsedBytes < sizeof(quint32)) + if (parsedBytes > (quint32)data.size() || data.size() - parsedBytes < qsizetype(sizeof(quint32))) return; static_assert(sizeof(float) == sizeof(quint32)); -- cgit v1.2.3