mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:47:45 +00:00
Kernel: Refuse to set overflowy resolution values in BXVGADevice
This commit is contained in:
parent
acf2061837
commit
fa40b725f9
1 changed files with 4 additions and 0 deletions
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Checked.h>
|
||||
#include <Kernel/Devices/BXVGADevice.h>
|
||||
#include <Kernel/PCI/Access.h>
|
||||
#include <Kernel/Process.h>
|
||||
|
@ -124,6 +125,9 @@ bool BXVGADevice::test_resolution(int width, int height)
|
|||
}
|
||||
bool BXVGADevice::set_resolution(int width, int height)
|
||||
{
|
||||
if (Checked<int>::multiplication_would_overflow(width, height, sizeof(u32)))
|
||||
return false;
|
||||
|
||||
if (!test_resolution(width, height))
|
||||
return false;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue