From cb849b287c1030f13eabbc8ae6a48b5e90ad2448 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sat, 11 Nov 2023 09:08:08 +1100 Subject: [PATCH] [hosts] nvfbc: exit loop early if ystart is > then dataHeight --- host/platform/Windows/capture/NVFBC/src/nvfbc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/host/platform/Windows/capture/NVFBC/src/nvfbc.c b/host/platform/Windows/capture/NVFBC/src/nvfbc.c index ec5044fc..3fe379c3 100644 --- a/host/platform/Windows/capture/NVFBC/src/nvfbc.c +++ b/host/platform/Windows/capture/NVFBC/src/nvfbc.c @@ -723,8 +723,12 @@ static CaptureResult nvfbc_getFrame(FrameBuffer * frame, int frameIndex) for (unsigned int y = 0; y < h; ++y) { const unsigned int ystart = y << this->diffShift; - const unsigned int yend = min(this->dataHeight, (y + 1) - << this->diffShift); + if (ystart > this->dataHeight) + break; + + const unsigned int yend = min( + this->dataHeight, + (y + 1) << this->diffShift); for (unsigned int x = 0; x < w; ) {