Check if data is not empty in dotnet integer decoding functions (#1030)

* Check if data is not empty in dotnet integer decoding functions

* Restart TeamCity

* Fix typo
This commit is contained in:
HoundThe 2021-10-01 13:59:29 +02:00 committed by GitHub
parent 5acc1bf6d5
commit c6605e7615
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,6 +36,9 @@ std::uint64_t decodeUnsigned(const std::vector<std::uint8_t>& data, std::uint64_
std::uint64_t result = 0;
bytesRead = 0;
if (data.empty())
return result;
// If highest bit not set, it is 1-byte number
if ((data[0] & 0x80) == 0)
{
@ -82,6 +85,9 @@ std::int64_t decodeSigned(const std::vector<std::uint8_t>& data, std::uint64_t&
std::int64_t result = 0;
bytesRead = 0;
if (data.empty())
return result;
// If highest bit not set, it is 1-byte number
if ((data[0] & 0x80) == 0)
{