mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:17:34 +00:00
LibWeb: Implement subtraction using saturated_addition in CSSPixels
Fixes overflow bug found by UBSAN.
This commit is contained in:
parent
26c20e3da1
commit
c431167736
2 changed files with 12 additions and 1 deletions
|
@ -112,7 +112,7 @@ CSSPixels CSSPixels::operator+(CSSPixels const& other) const
|
|||
CSSPixels CSSPixels::operator-(CSSPixels const& other) const
|
||||
{
|
||||
CSSPixels result;
|
||||
result.set_raw_value(raw_value() - other.raw_value());
|
||||
result.set_raw_value(saturated_addition(raw_value(), -other.raw_value()));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue