Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Console: Limit buffer size in ConsoleLogFromVM::Write #12034

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 12 additions & 17 deletions pcsx2/DebugTools/Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ struct ConsoleLog : public LogBase
// ConsoleLogFromVM
// --------------------------------------------------------------------------------------
// Special console logger for Virtual Machine log sources, such as the EE and IOP console
// writes (actual game developer messages and such). These logs do *not* automatically
// append newlines, since the VM generates them manually; and they do *not* support printf
// writes (actual game developer messages and such). These logs do *not* support printf
// formatting, since anything coming over the EE/IOP consoles should be considered raw
// string data. (otherwise %'s would get mis-interpreted).
//
Expand All @@ -102,22 +101,18 @@ class ConsoleLogFromVM : public LogBase
{
for (const char ch : msg)
{
if (ch == '\n')
{
if (!m_buffer.empty())
{
Console.WriteLn(conColor, m_buffer);
m_buffer.clear();
}
}
else if (ch < 0x20)
{
// Ignore control characters.
// Otherwise you get fun bells going off.
}
else
{
// Ignore control characters.
// Otherwise you get fun bells going off.
if (ch < 0x20)
continue;

if (ch != '\n')
m_buffer.push_back(ch);

if (ch == '\n' || m_buffer.size() >= 4096)
{
Console.WriteLn(conColor, m_buffer);
m_buffer.clear();
}
}

Expand Down