mirror of
https://github.com/storytold/lightcraft.git
synced 2026-11-01 14:07:34 -06:00
MonotoneCurve::eval let NaN past both bound checks into the binary search, which then indexed one past the end (or, for a NaN with the sign bit set, underflowed to -1). to_lut(1) divided 0 by 0, and Lut1::eval underflowed on `n - 2` for a table under two entries, which its public `v` allows. NaN now comes back as NaN, as Lut1::eval already did; to_lut, Lut1::identity and Lut1::from_fn make at least two entries; and a shorter table built by hand reads as a constant (one entry) or the identity (none). No caller reaches these today. Item 3 of #2579. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>