core: don't read negative pixel values in getColorFromPixel

This commit is contained in:
Vaxry 2024-10-24 23:51:22 +01:00
parent 17e1ebe9dc
commit 89b9352d26

View file

@ -459,7 +459,7 @@ void CHyprpicker::renderSurface(CLayerSurface* pSurface, bool forceInactive) {
CColor CHyprpicker::getColorFromPixel(CLayerSurface* pLS, Vector2D pix) {
pix = pix.floor();
if (pix.x >= pLS->screenBuffer->pixelSize.x || pix.y >= pLS->screenBuffer->pixelSize.y)
if (pix.x >= pLS->screenBuffer->pixelSize.x || pix.y >= pLS->screenBuffer->pixelSize.y || pix.x < 0 || pix.y < 0)
return CColor{0, 0, 0, 0};
void* dataSrc = pLS->screenBuffer->paddedData ? pLS->screenBuffer->paddedData : pLS->screenBuffer->data;