From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Format:Lua bytecode" |
|---|
| claim | "Lua 5.4 chunks store counts, line numbers, string sizes and other ints as varints: 7 bits per byte, most significant group first, with bit 7 set only on the LAST byte. Strings are varint (length + 1) followed by the bytes without the NUL; 0 means NULL." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:Lua bytecode" |
|---|
| observed_in | |
|---|
|
|---|
| data | | effect | "int/size_t fields are variable length" |
|---|
| condition | "version byte 0x54" |
|---|
| test_vectors | |
| input | "300" |
|---|
| expected | "02 AC" |
|---|
|
| input | "string of 299 bytes (size field 300)" |
|---|
| expected | "02 AC then 299 bytes" |
|---|
|
|
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "dumpSize fills the buffer in reverse and sets buff[DIBS - 1] |= 0x80 (last byte); dumpString writes size + 1 and the bytes without NUL (tag v5.4.8)" |
|---|
| repo | "https://github.com/lua/lua" |
|---|
| commit | "6e22fedb74cf0c9b6656e9fce8b7331db847c605" |
|---|
| path | "ldump.c" |
|---|
| lines | "65-101" |
|---|
|
| type | "runtime_test" |
|---|
| detail | "5.4.8 chunk of a 299-character string literal: tag 14 followed by 02 AC; the source name '@test.lua' has size byte 8A." |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Varint (Lua 5.4)" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T07:00:31.274Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T06:08:47.938Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read lua/lua 6e22fed ldump.c: dumpSize fills the buffer in reverse, 7 bits per byte and sets 0x80 on the last byte; dumpInt calls dumpSize; dumpString writes size+1 and the bytes without NUL, NULL as 0. Integer and float constants are dumped raw (dumpVar), not as varints, which the claim does not contradict." |
|---|
|
|
|---|