diff options
Diffstat (limited to 'src/network/access/http2/hpacktable.cpp')
-rw-r--r-- | src/network/access/http2/hpacktable.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/network/access/http2/hpacktable.cpp b/src/network/access/http2/hpacktable.cpp index 0b69ee86a9..2c728b37e3 100644 --- a/src/network/access/http2/hpacktable.cpp +++ b/src/network/access/http2/hpacktable.cpp @@ -26,8 +26,10 @@ HeaderSize entry_size(QByteArrayView name, QByteArrayView value) // for counting the number of references to the name and value would have // 32 octets of overhead." - const unsigned sum = unsigned(name.size() + value.size()); - if (std::numeric_limits<unsigned>::max() - 32 < sum) + size_t sum; + if (qAddOverflow(size_t(name.size()), size_t(value.size()), &sum)) + return HeaderSize(); + if (sum > (std::numeric_limits<unsigned>::max() - 32)) return HeaderSize(); return HeaderSize(true, quint32(sum + 32)); } @@ -346,8 +348,7 @@ quint32 FieldLookupTable::indexOfChunk(const Chunk *chunk) const return quint32(i); } - Q_UNREACHABLE(); - return 0; + Q_UNREACHABLE_RETURN(0); } quint32 FieldLookupTable::keyToIndex(const SearchEntry &key) const |