1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Improve checks for object files (#8417)

This commit is contained in:
Michał Janiszewski
2018-12-11 19:35:27 +01:00
committed by GitHub
parent 9f048c42df
commit 23dc14b286
2 changed files with 5 additions and 1 deletions

View File

@@ -71,7 +71,7 @@ class ObjectFileIndex final : public FileIndex<ObjectRepositoryItem>
{
private:
static constexpr uint32_t MAGIC_NUMBER = 0x5844494F; // OIDX
static constexpr uint16_t VERSION = 18;
static constexpr uint16_t VERSION = 19;
static constexpr auto PATTERN = "*.dat;*.pob;*.json;*.parkobj";
IObjectRepository& _objectRepository;

View File

@@ -195,6 +195,10 @@ size_t SawyerChunkReader::DecodeChunkRLE(void* dst, size_t dstCapacity, const vo
{
throw SawyerChunkException(EXCEPTION_MSG_DESTINATION_TOO_SMALL);
}
if (i + 1 + rleCodeByte + 1 > srcLength)
{
throw SawyerChunkException(EXCEPTION_MSG_CORRUPT_RLE);
}
std::memcpy(dst8, src8 + i + 1, rleCodeByte + 1);
dst8 += rleCodeByte + 1;