mirror of
https://github.com/avast/retdec.git
synced 2024-11-27 06:40:29 +00:00
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:
parent
5acc1bf6d5
commit
c6605e7615
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user