Skip to content
Permalink
Browse files

Bug 1399941 Part 1: Prevent aspect-ratio media queries from causing m…

…ultiplication overflow by extending values to u64.

MozReview-Commit-ID: e4kfxMDvZh
  • Loading branch information...
bradwerth committed Sep 14, 2017
1 parent f1da967 commit 52dc4f438a08f14c80a086c1a1162d9a3ac1230d
Showing with 3 additions and 1 deletion.
  1. +3 −1 components/style/gecko/media_queries.rs
@@ -752,7 +752,9 @@ impl Expression {
(&BoolInteger(one), &BoolInteger(ref other)) => one.cmp(other),
(&Float(one), &Float(ref other)) => one.partial_cmp(other).unwrap(),
(&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)) => {
let actual_dpi = unsafe {

0 comments on commit 52dc4f4

Please sign in to comment.
You can’t perform that action at this time.