Render stack: Add checks adjusted width and height in addition to unadjusted, mitigates crashes.

This commit is contained in:
OBattler
2025-11-11 16:48:41 +01:00
parent 8f2d5e4ccc
commit 02fac15d31

View File

@@ -464,7 +464,7 @@ RendererStack::createRenderer(Renderer renderer)
void
RendererStack::blit(int x, int y, int w, int h)
{
if ((x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (switchInProgress) || (monitors[m_monitor_index].target_buffer == NULL) || imagebufs.empty() || std::get<std::atomic_flag *>(imagebufs[currentBuf])->test_and_set()) {
if ((x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || ((w + y) > 2048) || ((h + x) > 2048) || (switchInProgress) || (monitors[m_monitor_index].target_buffer == NULL) || imagebufs.empty() || std::get<std::atomic_flag *>(imagebufs[currentBuf])->test_and_set()) {
video_blit_complete_monitor(m_monitor_index);
return;
}