Skip to content

Commit

Permalink
core: don't read negative pixel values in getColorFromPixel
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Oct 24, 2024
1 parent 17e1ebe commit 89b9352
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hyprpicker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 89b9352

Please sign in to comment.