aboutsummaryrefslogtreecommitdiff
path: root/render/wlr_renderer.c
diff options
context:
space:
mode:
authorRouven Czerwinski <rouven@czerwinskis.de>2020-06-16 07:21:36 +0200
committerSimon Ser <contact@emersion.fr>2020-06-16 15:16:02 +0200
commitd3d1bac1c290e5a383aca7cb857cc33702aeda78 (patch)
treed36a3e7dcb92348e4158f12dec97c24fb616d974 /render/wlr_renderer.c
parentcae533cad2b068dd13993a64fdc46c243c4984a2 (diff)
render: assert sane values for box functions
Width and height should always be > 0 for render functions which take a wlr_box. References https://github.com/swaywm/wlroots/issues/2281
Diffstat (limited to 'render/wlr_renderer.c')
-rw-r--r--render/wlr_renderer.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c
index 89a73fc8..016e4d6e 100644
--- a/render/wlr_renderer.c
+++ b/render/wlr_renderer.c
@@ -86,6 +86,7 @@ bool wlr_render_texture_with_matrix(struct wlr_renderer *r,
void wlr_render_rect(struct wlr_renderer *r, const struct wlr_box *box,
const float color[static 4], const float projection[static 9]) {
+ assert(box->width > 0 && box->height > 0);
float matrix[9];
wlr_matrix_project_box(matrix, box, WL_OUTPUT_TRANSFORM_NORMAL, 0,
projection);
@@ -101,6 +102,7 @@ void wlr_render_quad_with_matrix(struct wlr_renderer *r,
void wlr_render_ellipse(struct wlr_renderer *r, const struct wlr_box *box,
const float color[static 4], const float projection[static 9]) {
+ assert(box->width > 0 && box->height > 0);
float matrix[9];
wlr_matrix_project_box(matrix, box, WL_OUTPUT_TRANSFORM_NORMAL, 0,
projection);