mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-17 12:03:07 +01:00
Close #16002: Segfault opening ride statistics for huge ride
This commit is contained in:
@@ -10,17 +10,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "../common.h"
|
||||
#include "../core/Guard.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <cstring>
|
||||
|
||||
extern thread_local uint8_t gCommonFormatArgs[80];
|
||||
|
||||
enum class ride_id_t : uint16_t;
|
||||
|
||||
class Formatter
|
||||
{
|
||||
std::array<uint8_t, 80> Buffer{};
|
||||
std::array<uint8_t, 256> Buffer{};
|
||||
uint8_t* StartBuf{};
|
||||
uint8_t* CurrentBuf{};
|
||||
|
||||
@@ -59,7 +59,12 @@ public:
|
||||
|
||||
void Increment(size_t count)
|
||||
{
|
||||
CurrentBuf += count;
|
||||
auto finalCount = NumBytes() + count;
|
||||
Guard::Assert(finalCount < Buffer.size(), "Increment is greater than buffer size!");
|
||||
if (finalCount < Buffer.size())
|
||||
{
|
||||
CurrentBuf += count;
|
||||
}
|
||||
}
|
||||
|
||||
void Rewind()
|
||||
|
||||
Reference in New Issue
Block a user