Skip to content

Commit fa26541

Browse files
Copilotdy-tea
andauthored
Guard against zero-sized effect destination boxes
Co-authored-by: dy-tea <165158232+dy-tea@users.noreply.github.com>
1 parent 2000098 commit fa26541

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/effects.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,14 +422,19 @@ static bool compute_src_box(output_t *output, const struct wlr_box *r, struct wl
422422
if (sw <= 0.0f || sh <= 0.0f)
423423
return false;
424424

425+
int dw = (int)sw;
426+
int dh = (int)sh;
427+
if (dw <= 0 || dh <= 0)
428+
return false;
429+
425430
*src_out = (struct wlr_fbox){
426431
.x = sx,
427432
.y = sy,
428433
.width = sw,
429434
.height = sh
430435
};
431-
*dw_out = (int)sw;
432-
*dh_out = (int)sh;
436+
*dw_out = dw;
437+
*dh_out = dh;
433438
return true;
434439
}
435440

0 commit comments

Comments
 (0)