MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_huge_log_entry

Function test_huge_log_entry

tests/test_plugin.py:6001–6015  ·  view source on GitHub ↗

A single log entry larger than any stack buffer must not crash us. log_to_files() used to size its buffer with a variable-length array derived from the entry length, so a caller which could influence that length could run the stack out. Nothing bounds an entry: a plugin can hand us

(node_factory)

Source from the content-addressed store, hash-verified

5999
6000
6001def test_huge_log_entry(node_factory):
6002 """A single log entry larger than any stack buffer must not crash us.
6003
6004 log_to_files() used to size its buffer with a variable-length array
6005 derived from the entry length, so a caller which could influence that
6006 length could run the stack out. Nothing bounds an entry: a plugin can
6007 hand us one of any size, which is what this drives.
6008 """
6009 plugin_path = os.path.join(os.getcwd(), 'tests/plugins/hugelog.py')
6010 l1 = node_factory.get_node(options={'plugin': plugin_path})
6011
6012 assert l1.rpc.call('hugelog', {'bytelen': 8 * 1024 * 1024})['logged'] == 8 * 1024 * 1024
6013
6014 # Still alive, and still answering.
6015 assert l1.rpc.getinfo()['id'] == l1.info['id']
6016
6017
6018def test_command_collision(node_factory):

Callers

nothing calls this directly

Calls 4

joinMethod · 0.80
get_nodeMethod · 0.45
callMethod · 0.45
getinfoMethod · 0.45

Tested by

no test coverage detected