summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/debugger
diff options
context:
space:
mode:
author yz70s <yz70s@users.noreply.github.com>2026-03-09 20:45:16 +0100
committer yz70s <yz70s@users.noreply.github.com>2026-03-09 21:12:35 +0100
commit553ab2984864b4a27b16875cc71731cfd240c7b3 (patch)
tree40687eca59dc373d7f87eb04e21268a6191daaba /src/osd/modules/debugger
parent9d61c9b15fe82f0ce35946830cf90832ce266595 (diff)
Stop the windows debugger from crashing when using a widescreen monitor
Happened with text windows wider that 256 characters
Diffstat (limited to 'src/osd/modules/debugger')
-rw-r--r--src/osd/modules/debugger/win/debugviewinfo.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/osd/modules/debugger/win/debugviewinfo.cpp b/src/osd/modules/debugger/win/debugviewinfo.cpp
index 8f3f05c16d2..60883c9c364 100644
--- a/src/osd/modules/debugger/win/debugviewinfo.cpp
+++ b/src/osd/modules/debugger/win/debugviewinfo.cpp
@@ -503,7 +503,8 @@ void debugview_info::draw_contents(HDC windc)
COLORREF bgcolor = metrics().view_colors(DCA_NORMAL).second;
HBRUSH bgbrush = nullptr;
int last_attrib = -1;
- TCHAR buffer[256];
+ const int buffer_size = 512;
+ TCHAR buffer[buffer_size];
int count = 0;
RECT bounds;
@@ -551,7 +552,7 @@ void debugview_info::draw_contents(HDC windc)
}
else
{
- ExtTextOut(dc, bounds.left, bounds.top, 0, nullptr, buffer, count, nullptr);
+ ExtTextOut(dc, bounds.left, bounds.top, 0, nullptr, buffer, std::min(count, buffer_size), nullptr);
}
bounds.left = bounds.right;
count = 0;
@@ -571,7 +572,9 @@ void debugview_info::draw_contents(HDC windc)
}
// add this character to the buffer
- buffer[count++] = viewdata[col].byte;
+ if (count < buffer_size)
+ buffer[count] = viewdata[col].byte;
+ count++;
}
// flush any remaining stuff
@@ -597,7 +600,7 @@ void debugview_info::draw_contents(HDC windc)
}
else if (count > 0)
{
- ExtTextOut(dc, bounds.left, bounds.top, 0, nullptr, buffer, count, nullptr);
+ ExtTextOut(dc, bounds.left, bounds.top, 0, nullptr, buffer, std::min(count, buffer_size), nullptr);
}
}