aboutsummaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorAlexander Orzechowski <alex@ozal.ski>2023-08-02 11:51:53 -0400
committerSimon Ser <contact@emersion.fr>2023-08-14 08:08:39 +0000
commit664ec59095996662ad7c158c64a2d5dfc50f58a1 (patch)
tree620e843bdf22ee3df25d922a05ccae7c51ac1e43 /render
parentaee31edaadf90f14569d8cf844df76ef003d1c30 (diff)
renderer: Sanity check texture source bounds
Diffstat (limited to 'render')
-rw-r--r--render/pass.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/render/pass.c b/render/pass.c
index 650353cb..444f964e 100644
--- a/render/pass.c
+++ b/render/pass.c
@@ -26,6 +26,15 @@ bool wlr_render_pass_submit(struct wlr_render_pass *render_pass) {
void wlr_render_pass_add_texture(struct wlr_render_pass *render_pass,
const struct wlr_render_texture_options *options) {
+ // make sure the texture source box does not try and sample outside of the
+ // texture
+ if (!wlr_fbox_empty(&options->src_box)) {
+ const struct wlr_fbox *box = &options->src_box;
+ assert(box->x >= 0 && box->y >= 0 &&
+ box->x + box->width <= options->texture->width &&
+ box->y + box->height <= options->texture->height);
+ }
+
render_pass->impl->add_texture(render_pass, options);
}