1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! DF-7 - value-range and symbolic-length lattice.
//!
//! Interval abstract domain over integer-typed variables:
//! `⟨lo, hi⟩ ∈ {−∞, ℤ, +∞}²`. Overflow tracked as a separate flag
//! so the domain is sound under wrap-around arithmetic.
//!
//! Extended with symbolic-length expressions: `len(buf) + k`, where
//! `k` is a range constant. Critical for C05 (integer trunc →
//! undersized alloc → OOB) and C19 (ioctl size fields that bypass
//! `copy_from_user` bound checks when the lattice concretizes to a
//! non-trivial range).
//!
//! # Implementation
//!
//! Each variable occupies two consecutive u32 slots `[lo, hi]`
//! in the flat buffer. One invocation per variable, indexed by
//! `InvocationId` axis 0. The edge transfer is an additive shift
//! per variable (`lo' = lo + t_lo`, `hi' = hi + t_hi`) - the
//! simplest interval transfer that covers assign, add-const, and
//! symbolic-length-plus-k.
//!
//! Meet at join points is the caller's responsibility: join two
//! runs of this primitive with an element-wise `min(lo, lo')` /
//! `max(hi, hi')` kernel (built via `vyre_primitives::math` ops).
//!
//! Soundness: [`MayOver`](super::Soundness::MayOver) in the standard
//! abstract-interpretation sense. Zero-FP rules that consume this
//! lattice must pair with DF-3 + an aliasing filter.
#[cfg(any(test, feature = "cpu-parity"))]
mod cpu_oracle;
mod dispatch;
mod program;
mod scratch;
mod tag;
#[cfg(test)]
mod tests;
pub(crate) const OP_ID: &str = "weir::range";
#[cfg(any(test, feature = "cpu-parity"))]
#[allow(deprecated)]
pub(crate) use cpu_oracle::range_propagate_cpu;
pub use dispatch::{
range_propagate_borrowed_into_result_with_scratch_via, range_propagate_borrowed_into_via,
range_propagate_borrowed_via, range_propagate_borrowed_with_scratch_via, range_propagate_via,
};
pub use program::{range_propagate, try_range_propagate, try_range_propagate_with_count};
#[cfg(any(test, feature = "legacy-infallible"))]
pub use program::range_propagate_with_count;
pub use scratch::RangePropagateScratch;
pub use tag::Range;