Skip to content

v1.15.1

Latest

Choose a tag to compare

@yhirose yhirose released this 29 Jul 00:12

Bug Fixes

  • Fix undefined 32-bit shift in packrat mix() on wasm32 (4b3bd64): The packrat cache's hash function performed h >> 32 on a size_t-typed value. On wasm32, where size_t is 32 bits, this shift is undefined behavior — clang -O2 detected it and collapsed the packrat lookup into unreachable, causing a trap at parse time. Fixed by mixing in uint64_t and narrowing at the end (bit-identical to the previous behavior on 64-bit targets).

  • Serialize grammar definitions in name order (73a37a3): GrammarBlob::serialize walked Grammar (a std::unordered_map) in its raw iteration order, which is implementation-defined — the same grammar could produce different byte sequences under different standard libraries, making a checked-in blob non-byte-comparable across platforms. Fixed by emitting definitions sorted by name (deserialize() rebuilds the map from names, so nothing depends on the order).

Both fixes include new tests in test_serialize.cc.