mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-18 11:54:30 +01:00
DrawBuffer::V(): don't overflow verts_ in release builds
The only guard against writing past the fixed 65536-entry verts_ array was _dbg_assert_msg_, which is compiled out entirely outside _DEBUG - a large enough single batch (e.g. Circle()/CircleSegment() with a big segment count, or a large UI list without an intervening Flush()) silently corrupted the heap in release builds. Added a real bounds check that drops the vertex instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L4QAoxV2KY7ek4PcZw3WvY
This commit is contained in:
1 parent
ef87fe2e74
commit
1a9f2f827f
1 file changed
+5
@@ -89,6 +89,11 @@ public:
|
||||
|
||||
void V(float x, float y, float z, uint32_t color, float u, float v) {
|
||||
_dbg_assert_msg_(count_ < MAX_VERTS, "Overflowed the DrawBuffer");
|
||||
if (count_ >= MAX_VERTS) {
|
||||
// _dbg_assert_msg_ above is compiled out in release builds - don't write
|
||||
// past the end of verts_ there either, just drop the vertex.
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (my_isnanorinf(x) || my_isnanorinf(y) || my_isnanorinf(z)) {
|
||||
|
||||
Reference in new issue
Block a user