Skip to content

Commit af186dd

Browse files
qarkaicaclark
authored andcommitted
Check clamp boundaries
1 parent df29cec commit af186dd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/renderer-tiles.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1731,7 +1731,7 @@ gboolean rt_clamp_to_visible(RendererTiles *rt, gint *x, gint *y, gint *w, gint
17311731
const gint vw = pr->vis_width;
17321732
const gint vh = pr->vis_height;
17331733

1734-
if (*x + *w < vx || *x > vx + vw || *y + *h < vy || *y > vy + vh) return FALSE;
1734+
if (vw < 1 || vh < 1 || *x + *w < vx || *x > vx + vw || *y + *h < vy || *y > vy + vh) return FALSE;
17351735

17361736
/* now clamp it */
17371737
const gint nx = std::max(*x, vx);
@@ -1840,6 +1840,8 @@ void rt_queue(RendererTiles *rt, gint x, gint y, gint w, gint h,
18401840

18411841
rt_sync_scroll(rt);
18421842

1843+
if (pr->width < 1 || pr->height < 1) return;
1844+
18431845
const gint nx = std::clamp(x, 0, pr->width - 1);
18441846
const gint ny = std::clamp(y, 0, pr->height - 1);
18451847

0 commit comments

Comments
 (0)