os: fix multiplication wrap-around in Area::count

When having a maximized terminal window, a suspend was causing an
invalid mode change at nitpicker. This triggered a huge resource request
in nitpicker because the RAM-quota check was rendered ineffective by a
wrap-around during unsigned multiplication.

Issue genodelabs/genode#5180
Fixes genodelabs/genode#5201
This commit is contained in:
Johannes Schlatow 2024-04-16 11:14:03 +02:00 committed by Norman Feske
parent dc5990ce4a
commit 78a6d2bd0c

View File

@ -105,7 +105,7 @@ class Genode::Area
bool valid() const { return _w > 0 && _h > 0; }
size_t count() const { return _w*_h; }
size_t count() const { return (size_t)_w*(size_t)_h; }
/**
* Operator for testing non-equality of two areas