emptybuffer
function · lua · boundary
- Address
0x6f5140· 48 bytes, up to0x6f516f- Meaning
- Pushes the buffer contents as a string and resets the fill pointer
- Confidence
- verified, proof one
- Finding
- lua/auxlib#string-buffers
Finding: String buffers in lua: the auxiliary library
A luaL_Buffer is p at +0, the number of stack pieces at +4, the state at +8 and 512
bytes at +0xc. luaL_buffinit sets it up. Adding bytes fills the area; when it is full
emptybuffer pushes its contents as a string and adjuststack merges the pushed pieces from the
top by lua_concat while the pieces taken so far are longer than the next one, or ten are pushed. luaL_pushresult pushes
the rest and joins them, and luaL_addvalue adds the string on the stack top.
| function | name | decided by |
|---|---|---|
0x6f5120 | luaL_prepbuffer | emptybuffer (0x6f5123), adjuststack when it pushed (0x6f512e), returns buf+0xc |
0x6f5140 | emptybuffer | length p-buf-0xc (0x6f5147), lua_pushlstring (0x6f515a), level count +4 raised (0x6f5164) |
0x6f5170 | adjuststack | lua_strlen pairs (0x6f5190, 0x6f51a5), limit 10 (0x6f51b2), lua_concat (0x6f51cf) |
0x6f51f0 | luaL_addlstring | calls luaL_prepbuffer when the area is full (0x6f520f) |
0x6f5230 | luaL_addstring | length by repne scasb, then luaL_addlstring (0x6f5243) |
0x6f5250 | luaL_pushresult | emptybuffer (0x6f5253), lua_concat (0x6f525e), level reset to 1 |
0x6f5270 | luaL_addvalue | lua_strlen, lua_tostring (0x6f52a3), copy when it fits, else lua_insert and adjuststack (0x6f52e7, 0x6f52f5) |
0x6f5300 | luaL_buffinit | stores L at +8, p = buf+0xc, level 0 (0x6f5303, 0x6f5306, 0x6f5308) |
The derivation is in the doc.
Callers 3
- luaL_prepbuffer lua
- luaL_pushresult lua
- luaL_addvalue lua
Callees 1
- lua_pushlstring lua
Calls and jumps by a bare address, from tables/calls.tsv.