]> git.kaiwu.me - njs.git/commit
Parser: fix reference atom IDs on big-endian systems
authorDmitry Volyntsev <xeioex@nginx.com>
Thu, 22 Oct 2026 04:49:20 +0000 (21:49 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Fri, 23 Oct 2026 23:13:30 +0000 (16:13 -0700)
commit4ee6f12facd274f2c1202c1bf9edbb24aa64c2d0
tree0e94506872b676d94981f43d3a31bafc762e3222
parent88285bc5472938375148215648faca21845b8845
Parser: fix reference atom IDs on big-endian systems

Previously, references to local variables and function arguments
failed with ReferenceError on 64-bit big-endian systems.  The parser
overwrote a uintptr_t reference atom ID through the overlapping
uint32_t value member, replacing the high half of the ID.

The issue was introduced in 9ff881e3 (1.0.2), which moved the
reference atom ID to the start of the parser node union.

Now, reference and value payloads share a uint32_t atom ID at the same
offset, initialized in the corresponding parser paths.
This removes the redundant value-member write and makes atom ID access
independent of byte order without increasing the parser node size.

This fixes #1143.
src/njs_generator.c
src/njs_parser.c
src/njs_parser.h
src/njs_variable.c
src/njs_variable.h