Repository navigation
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 complexinstead of exhausting the C stack, andpb.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.luadescriptor parity. proto3optionalnow produces the same
descriptors as protoc (synthetic oneofs), and descriptor output matches
protoc for escapes, float exponents, ranges,import publicand inline
options. A failed parse no longer leaves types behind.- New
protoc_test.luawith 65 cases: 53 passing and 12 tracked
known issues (runlua protoc_test.lua -x known_issuefor the healthy
subset).
Fixes
pb.buffer:result()andpb.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:packreports 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_DEADKEYand its dead table slot are gone.
protoc.lua
- proto3
optionalis accepted by default;p.proto3_optional = false
restores the old rejection. Synthetic oneofs are named_field(no doubled
underscore), get anXprefix on collision, and are ordered after real
oneofs. Extension fields getproto3_optionalwithoutoneof_index. - Descriptor output fixes:
default_value = "nil"for fields with inline
options, spurious empty options messages,\xNN/\NNNescapes, float
exponents such as1e-3, exclusive range ends for extension and reserved
ranges (inclusive for enum ranges), and a plainimportno longer recorded
as a public dependency. - Parser robustness: failed parses roll back registered types,
include_importsemits each file once, import cycles and self-imports are
reported,unknown_importaccepts a Lua pattern,unknown_typemay return
a type name plus kind, and duplicate nested enum names/numbers are rejected.
Tooling and internals
.clang-formatis now checked in;pb.h/pb.cwere 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_optionalwas removed; use
p.proto3_optional(proto3 optional is allowed by default).- The internal
lpb_pushunpackdefsymbol is static again and no longer
exported frompb.so(it was never declared inpb.h). buffer:packvalidates 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