Skip to content

Commit

Permalink
tweak(conhost): use circular_buffer instead of ImVector
Browse files Browse the repository at this point in the history
- `Items` and `ItemKeys` use a circular buffer and can only store `2500` items, but ItemTimes could expand and store more.
- This would cause a crash at https://github.com/citizenfx/fivem/blob/705cd7901ac03c5a0d1e1355d94e84046309b80d/code/components/conhost-v2/src/ConsoleHostGui.cpp#L729-L734 because `ItemTimes` would have a capacity of 2500+ but `Items` and ItemKeys` would be empty
  • Loading branch information
AvarianKnight committed Aug 19, 2024
1 parent 705cd79 commit cedb91f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion code/components/conhost-v2/src/ConsoleHostGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ auto msec()

struct MiniConsole : CfxBigConsole
{
ImVector<std::chrono::milliseconds> ItemTimes;
boost::circular_buffer<std::chrono::milliseconds> ItemTimes{ 2500 };

ConVar<std::string>* m_miniconChannels;
std::string m_miniconLastValue;
Expand Down

0 comments on commit cedb91f

Please sign in to comment.