Skip to content

0.6.0

Latest

Choose a tag to compare

@starwing starwing released this 01 Nov 15:41

Highlights

  • Lua 5.5 support. The C module builds and passes the test suite on Lua
    5.5; Lua 5.1–5.4 and LuaJIT remain supported.
  • Hardened against malicious input. Deeply nested messages now fail with
    message too complex instead of exhausting the C stack, and pb.load()
    rejects descriptors nested deeper than 100 levels instead of recursing
    without a bound. Thanks to Brian Lee (Team Atlanta) for the vulnerability
    report and his review of the decode fix.
  • protoc.lua descriptor parity. proto3 optional now produces the same
    descriptors as protoc (synthetic oneofs), and descriptor output matches
    protoc for escapes, float exponents, ranges, import public and inline
    options. A failed parse no longer leaves types behind.
  • New protoc_test.lua with 65 cases: 53 passing and 12 tracked
    known issues (run lua protoc_test.lua -x known_issue for the healthy
    subset).

Fixes

  • pb.buffer:result() and pb.slice:result() return "" for an empty
    buffer/slice instead of raising.
  • pb.buffer.pack("c", "") accepts zero-length slices (it used to raise
    "out of memory").
  • Negative enum values (e.g. -1) are no longer lost from type tables.
  • buffer:pack reports an invalid format before consuming its arguments;
    slice:unpack("+", n) clamps to the start of the slice instead of reading
    before it.
  • Undefined behavior fixed in the type-table hash (signed overflow), the
    packed repeated and map decode paths, and the encoder scratch buffer.
    PBT_DEADKEY and its dead table slot are gone.

protoc.lua

  • proto3 optional is accepted by default; p.proto3_optional = false
    restores the old rejection. Synthetic oneofs are named _field (no doubled
    underscore), get an X prefix on collision, and are ordered after real
    oneofs. Extension fields get proto3_optional without oneof_index.
  • Descriptor output fixes: default_value = "nil" for fields with inline
    options, spurious empty options messages, \xNN/\NNN escapes, float
    exponents such as 1e-3, exclusive range ends for extension and reserved
    ranges (inclusive for enum ranges), and a plain import no longer recorded
    as a public dependency.
  • Parser robustness: failed parses roll back registered types,
    include_imports emits each file once, import cycles and self-imports are
    reported, unknown_import accepts a Lua pattern, unknown_type may return
    a type name plus kind, and duplicate nested enum names/numbers are rejected.

Tooling and internals

  • .clang-format is now checked in; pb.h/pb.c were reformatted to 80
    columns with no behavior change, and static analyzer findings were fixed.
  • CI tests Lua 5.4.8 and 5.5.0 alongside 5.1–5.3 and LuaJIT.

Breaking changes

  • p.experimental_allow_proto3_optional was removed; use
    p.proto3_optional (proto3 optional is allowed by default).
  • The internal lpb_pushunpackdef symbol is static again and no longer
    exported from pb.so (it was never declared in pb.h).
  • buffer:pack validates the format before its arguments, so an invalid
    format now raises a format error rather than an argument error.

Full Changelog: 0.5.3...0.6.0