Skip to content

Commit

Permalink
(#2509) Handling integer overflows for dimensions for XWaylandSurface
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkae committed Sep 21, 2023
1 parent da0c8fa commit 49dc39d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/server/frontend_xwayland/xwayland_surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1223,8 +1223,12 @@ void mf::XWaylandSurface::prep_surface_spec(ProofOfMutexLock const&, msh::Surfac

#define SCALE_SIZE(type, prop) \
if (mods.prop) \
{ \
mods.prop = std::max(geom::type{1}, mods.prop.value() * inv_scale); \
{ \
auto scaled_value = mods.prop.value() * inv_scale; \
if (scaled_value.as_int() >= 0) \
{ \
mods.prop = scaled_value; \
} \
}

SCALE_SIZE(Width, width);
Expand Down

0 comments on commit 49dc39d

Please sign in to comment.