Skip to content

v1.2.2

Choose a tag to compare

@rossnichols rossnichols released this 16 Jul 00:09
· 2 commits to main since this release
40d96aa

Correctness fixes for a number of serialization edge cases, each covered by new regression tests. Validated on Lua 5.1.4 (matching WoW), Lua 5.4, and LuaJIT 2.1.

Fixed

• Crash with  stable = true  when a table had two or more keys of a reference type (tables/functions) or an incomparable mix such as a boolean key alongside a table key. Stable serialization now handles all key types.
• Large integers no longer corrupt or error. On Lua 5.3+, integers with magnitude greater than 2⁵³ (e.g.  2^56 ,  0x1234567890ABCDEF ,  math.maxinteger ) were silently corrupted, and  math.mininteger  raised an error. They now round-trip exactly.
• Subnormal (denormal) floats were serialized as zero; they now round-trip correctly.
• Negative zero ( -0.0 ) collapsed to  +0.0 ; its sign is now preserved.
• Non-table  __LibSerialize  metatable field raised an error; it is now ignored.

Changed

• Integer subtype is preserved on Lua 5.3+. Deserialized integers now come back as the  integer  subtype (previously small values were returned as floats). This is value-preserving and has no effect under WoW's Lua 5.1.

Compatibility

• Backward compatible for the common cases. The new large-integer and negative-zero encodings reuse an existing type, so data produced by this release can still be read by older versions (v1.2.1 and earlier). No serialization-format version bump.
• One exception — subnormals. Values in the subnormal range written by this release are misread by pre-release versions. In practice this is negligible: subnormals are astronomically rare, and older versions could never produce them (they wrote zero), so there is no existing data to conflict with.
• WoW (Lua 5.1) behavior is otherwise unchanged apart from the fixes above.