Clamp height and ystart to semi-sensible values to avoid memory corruption.

This commit is contained in:
Christian Speckner 2020-01-07 20:48:05 +01:00
parent bd9734ec66
commit c4e7088b0e
1 changed files with 2 additions and 2 deletions

View File

@ -243,8 +243,8 @@ void FrameManager::recalculateMetrics() {
throw runtime_error("frame manager: invalid TV mode");
}
myHeight = baseHeight + myAdjustScanlines * 2;
myYStart = std::max(0, ystartBase + (baseHeight - static_cast<Int32>(myHeight)) / 2 + myVcenter);
myHeight = BSPF::clamp<uInt32>(baseHeight + myAdjustScanlines * 2, 0, myFrameLines);
myYStart = BSPF::clamp<uInt32>(ystartBase + (baseHeight - static_cast<Int32>(myHeight)) / 2 + myVcenter, 0, myFrameLines);
myJitterEmulation.setYStart(myYStart);
}