mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Bug 1399941 Part 1: Prevent aspect-ratio media queries from causing multiplication overflow by extending values to u64.
MozReview-Commit-ID: e4kfxMDvZh
This commit is contained in:
parent
f1da967ef7
commit
52dc4f438a
1 changed files with 3 additions and 1 deletions
|
@ -752,7 +752,9 @@ impl Expression {
|
||||||
(&BoolInteger(one), &BoolInteger(ref other)) => one.cmp(other),
|
(&BoolInteger(one), &BoolInteger(ref other)) => one.cmp(other),
|
||||||
(&Float(one), &Float(ref other)) => one.partial_cmp(other).unwrap(),
|
(&Float(one), &Float(ref other)) => one.partial_cmp(other).unwrap(),
|
||||||
(&IntRatio(one_num, one_den), &IntRatio(other_num, other_den)) => {
|
(&IntRatio(one_num, one_den), &IntRatio(other_num, other_den)) => {
|
||||||
(one_num * other_den).partial_cmp(&(other_num * one_den)).unwrap()
|
// Extend to avoid overflow.
|
||||||
|
(one_num as u64 * other_den as u64).cmp(
|
||||||
|
&(other_num as u64 * one_den as u64))
|
||||||
}
|
}
|
||||||
(&Resolution(ref one), &Resolution(ref other)) => {
|
(&Resolution(ref one), &Resolution(ref other)) => {
|
||||||
let actual_dpi = unsafe {
|
let actual_dpi = unsafe {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue