View deserialize_webrenderish.s
__ZN7my_test21deserialize_webrender17hecde0d914cb271c7E:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $264, %rsp
movq %rdx, -264(%rbp)
View _main.rs
#![allow(dead_code)]
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate bincode;
use serde::{Deserialize};
use std::{ptr, io, slice};
View deserialize_from.s
__ZN7my_test16deserialize_from17hb61a0712b5bb1dfcE:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $224, %rsp
movq %rdx, %rbx
movq %rbx, -144(%rbp)
pxor %xmm0, %xmm0
movdqa %xmm0, -192(%rbp)
View deserialize.s
__ZN7my_test11deserialize17hd8cae30d7665ff4eE:
Lfunc_begin17:
.loc 16 60 0
.cfi_startproc
pushq %rbp
Lcfi72:
.cfi_def_cfa_offset 16
Lcfi73:
.cfi_offset %rbp, -16
movq %rsp, %rbp
View deserialize.s
__ZN7my_test11deserialize17hb93d291037dcd9ddE:
Lfunc_begin4:
.cfi_startproc
.cfi_personality 155, _rust_eh_personality
.cfi_lsda 16, Lexception4
pushq %rbp
Lcfi97:
.cfi_def_cfa_offset 16
Lcfi98:
.cfi_offset %rbp, -16
View deserialize.s
__ZN7my_test11deserialize17hb93d291037dcd9ddE:
.cfi_startproc
pushq %rbp
Lcfi95:
.cfi_def_cfa_offset 16
Lcfi96:
.cfi_offset %rbp, -16
movq %rsp, %rbp
Lcfi97:
.cfi_def_cfa_register %rbp
View casts.md

Help Us Benchmark Saturating Float Casts!

TL;DR: please profile/benchmark your code with and without -Zsaturating-float-casts so we can make an informed decision! We are hoping to enable this flag by default in future versions to plug a long-standing soundness hole!

Background

Since long before Rust 1.0, float->int casts have had a soundness hole: if the input value is larger or smaller than the target type can hold (or NaN), the result is Undefined Behaviour. This is because we just lower these casts to LLVM intrinsics, and that's what those intrinsics say.

For instance, -1.0 as u8, 300.0 as i8, NaN as u32, and f32::INFINITY as u128 are all currently UB in Rust.

View prim.diff
diff --git a/webrender/res/ps_line.glsl b/webrender/res/ps_line.glsl
index 1d04f24a..77ba5d36 100644
--- a/webrender/res/ps_line.glsl
+++ b/webrender/res/ps_line.glsl
@@ -22,13 +22,14 @@ varying vec2 vLocalPos;
struct Line {
vec4 color;
+ float wavyLineWidth;
float style;
View map2.rs
#[derive(Copy, Clone)]
enum Action {
Insert(u64),
Remove(u64),
}
use Action::*;
use std::hash::{BuildHasherDefault, Hasher};
use std::collections::HashMap;
View map.rs
#[derive(Copy, Clone)]
enum Action {
Insert(u64),
Remove(u64),
}
use Action::*;
use std::hash::{BuildHasherDefault, Hasher};
use std::collections::HashMap;