ff460b9b
wire: bypass LuaJIT NaN-boxing collision in decode_float/decode_double
Reading a NaN-payload double back through `tonumber(F.d)` runs into LuaJIT 2.1's NaN-boxed value representation: certain IEEE NaN bit patterns collide with internal type tags (nil, function, ...) so `tonumber` yields a non-number and the field is silently dropped during encoding. Inspect the raw bit pattern via the uint32_t/uint64_t aliases of the float/double unions before reaching for the Lua-level value. When the exponent is all-ones we resolve Inf/NaN ourselves; only normal values hit `tonumber`. Closes the conformance suite's DoubleFieldNormalizeSignalingNan and FloatFieldNormalizeSignalingNan JsonOutput tests, which used bit patterns (0x7FFBCBA987654321, 0x7FBFFFFF) that hit the collision.
Eugene Blikh <bigbes@gmail.com> — 2026-05-16 06:14:30 UTC
Commit ff460b9b7aa9700c1648300000750e62e9108e45 —
view raw patch
Parent(s):
37c56322
| File | Status | + | − |
|---|---|---|---|
runtime/pb/wire.lua
|
M | +33 |