diff --git a/CHANGELOG.md b/CHANGELOG.md index f25814b8..6c4f998d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,8 +77,12 @@ * config: improved validation of color values. * config: double close of file descriptor, resulting in a chain of errors ultimately leading to a startup failure ([#1531][1531]). +* Crash when using a desktop scaling factor > 1, on compositors that + implements neither the `fractional-scale-v1`, nor the + `cursor-shape-v1` Wayland protocols ([#1573][1573]). [1531]: https://codeberg.org/dnkl/foot/issues/1531 +[1573]: https://codeberg.org/dnkl/foot/issues/1573 ### Security diff --git a/wayland.c b/wayland.c index a87bf45d..34050d18 100644 --- a/wayland.c +++ b/wayland.c @@ -2024,10 +2024,19 @@ surface_scale_explicit_width_height( "(width=%d, height=%d)", scale, width, height); xassert(scale == floorf(scale)); - const int iscale = (int)floorf(scale); - xassert(width % iscale == 0); - xassert(height % iscale == 0); + + if (verify) { + if (width % iscale != 0) { + BUG("width=%d is not valid with scaling factor %.2f (%d %% %d != 0)", + width, scale, width, iscale); + } + + if (height % iscale != 0) { + BUG("height=%d is not valid with scaling factor %.2f (%d %% %d != 0)", + height, scale, height, iscale); + } + } wl_surface_set_buffer_scale(surf->surf, iscale); }