static TString *internshrstr (lua_State *L, const char *str, size_t l) {
  TString *ts;
  global_State *g = G(L);
  stringtable *tb = &g->strt;
  unsigned int h = luaS_hash(str, l, g->seed);
  TString **list = &tb->hash[lmod(h, tb->size)];
  lua_assert(str != NULL);
  for (ts = *list; ts != NULL; ts = ts->u.hnext) {
    if (l == cast_uint(ts->shrlen) &&
        (memcmp(str, getshrstr(ts), l * sizeof(char)) == 0)) {

      if (isdead(g, ts))
        changewhite(ts);
      return ts;
    }
  }

  if (tb->nuse >= tb->size) {
    growstrtab(L, tb);
    list = &tb->hash[lmod(h, tb->size)];
  }
  ts = createstrobj(L, sizestrshr(l), LUA_VSHRSTR, h);
  ts->shrlen = cast_byte(l);
  getshrstr(ts)[l] = '\0';
  memcpy(getshrstr(ts), str, l * sizeof(char));
  ts->u.hnext = *list;
  *list = ts;
  tb->nuse++;
  return ts;
}

Input: {'L': '{next: {next: NULL, tt: 8 \'\\b\', marked: 8 \'\\b\'}, tt: 5 \'\\005\', marked: 8 \'\\b\', status: 127 \'\\177\', allowhook: 0 \'\\000\', nci: 3, top: {p: 0xf58880, offset: 16091264}, l_G: {frealloc: NULL, ud: VOID, totalbytes: 0, totalobjs: 5306232, GCdebt: 5306211, marked: 5306190, GCmajorminor: 5306169, strt: {hash: 0x4005e077e25048a, nuse: 5306422, size: 0}, l_registry: {value_: {gc: 0x50f70f <luaT_trybinTM+287>, p: 0x50f70f <luaT_trybinTM+287>, f: 0x50f70f <luaT_trybinTM+287>, i: 5306127, n: 2.621575063170676e-317, ub: 15 \'\\017\'}, tt_: 110 \'n\'}, nilvalue: {value_: {gc: 0x6e61656c6f6f6200, p: 0x6e61656c6f6f6200, f: 0x6e61656c6f6f6200, i: 7953749933313450496, n: 5.0306121363478635e+223, ub: 0 \'\\000\'}, tt_: 0 \'\\000\'}, seed: 1869901682, gcparams: "\\000__ind", currentwhite: 101 \'e\', gcstate: 120 \'x\', gckind: 0 \'\\000\', gcstopem: 95 \'_\', gcstp: 95 \'_\', gcemergency: 110 \'n\', allgc: error, sweepgc: error, finobj: error, gray: error, grayagain: error, weak: error, ephemeron: error, allweak: error, tobefnz: error, fixedgc: error, survival: error, old1: error, reallyold: error, firstold1: error, finobjsur: error, finobjold1: error, finobjrold: error, twups: error, panic: 0x2d4c28280065736f, mainthread: error, memerrmsg: error, tmname: [{\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585938\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x3d3e2074743e2d29\\n\', \'message\': \'Cannot access memory at address 0x3d3e2074743e2d29\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585940\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x632e6d746c003420\\n\', \'message\': \'Cannot access memory at address 0x632e6d746c003420\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585948\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x756c2064696f7600\\n\', \'message\': \'Cannot access memory at address 0x756c2064696f7600\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585950\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x2874696e695f5461\\n\', \'message\': \'Cannot access memory at address 0x2874696e695f5461\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585958\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x746174535f61756c\\n\', \'message\': \'Cannot access memory at address 0x746174535f61756c\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585960\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x65766500292a2065\\n\', \'message\': \'Cannot access memory at address 0x65766500292a2065\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585968\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x4d54203d3c20746e\\n\', \'message\': \'Cannot access memory at address 0x4d54203d3c20746e\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585970\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x736e6f630051455f\\n\', \'message\': \'Cannot access memory at address 0x736e6f630051455f\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585978\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x65756c6156542074\\n\', \'message\': \'Cannot access memory at address 0x65756c6156542074\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585980\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x675f5461756c2a20\\n\', \'message\': \'Cannot access memory at address 0x675f5461756c2a20\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585988\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x626154286d747465\\n\', \'message\': \'Cannot access memory at address 0x626154286d747465\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585990\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x4d54202c2a20656c\\n\', \'message\': \'Cannot access memory at address 0x4d54202c2a20656c\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585998\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x6972745354202c53\\n\', \'message\': \'Cannot access memory at address 0x6972745354202c53\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x5859a0\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x6f6300292a20676e\\n\', \'message\': \'Cannot access memory at address 0x6f6300292a20676e\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x5859a8\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x6c6156542074736e\\n\', \'message\': \'Cannot access memory at address 0x6c6156542074736e\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x5859b0\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x5461756c2a206575\\n\', \'message\': \'Cannot access memory at address 0x5461756c2a206575\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x5859b8\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x79626d747465675f\\n\', \'message\': \'Cannot access memory at address 0x79626d747465675f\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x5859c0\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x5f61756c286a626f\\n\', \'message\': \'Cannot access memory at address 0x5f61756c286a626f\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x5859c8\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x2c2a206574617453\\n\', \'message\': \'Cannot access memory at address 0x2c2a206574617453\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x5859d0\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x542074736e6f6320\\n\', \'message\': \'Cannot access memory at address 0x542074736e6f6320\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x5859d8\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x2c2a2065756c6156\\n\', \'message\': \'Cannot access memory at address 0x2c2a2065756c6156\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x5859e0\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x6f630029534d5420\\n\', \'message\': \'Cannot access memory at address 0x6f630029534d5420\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x5859e8\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x726168632074736e\\n\', \'message\': \'Cannot access memory at address 0x726168632074736e\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x5859f0\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x6f5f5461756c2a20\\n\', \'message\': \'Cannot access memory at address 0x6f5f5461756c2a20\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x5859f8\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x616e657079746a62\\n\', \'message\': \'Cannot access memory at address 0x616e657079746a62\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}], mt: [{\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585a00\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x535f61756c28656d\\n\', \'message\': \'Cannot access memory at address 0x535f61756c28656d\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585a08\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x202c2a2065746174\\n\', \'message\': \'Cannot access memory at address 0x202c2a2065746174\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585a10\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x56542074736e6f63\\n\', \'message\': \'Cannot access memory at address 0x56542074736e6f63\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585a18\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x292a2065756c61\\n\', \'message\': \'Cannot access memory at address 0x292a2065756c61\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585a20\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x2800656d616e5f5f\\n\', \'message\': \'Cannot access memory at address 0x2800656d616e5f5f\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585a28\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x616e282828282828\\n\', \'message\': \'Cannot access memory at address 0x616e282828282828\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585a30\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x74743e2d2929656d\\n\', \'message\': \'Cannot access memory at address 0x74743e2d2929656d\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585a38\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x783020262029295f\\n\', \'message\': \'Cannot access memory at address 0x783020262029295f\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}, {\'@\': \'POINTER\', \'type\': None, \'address\': \'0x585a40\', \'value\': {\'@\': \'error\', \'error_type\': \'gdb.MemoryError\', \'stacktrace\': \'Traceback (most recent call last):\\n  File "/tracer/var_utils.py", line 72, in serialize_value_to_json\\n    if str(value) == "0x0":\\ngdb.MemoryError: Cannot access memory at address 0x203d3d2029294630\\n\', \'message\': \'Cannot access memory at address 0x203d3d2029294630\', \'@@\': \'struct\'}, \'@@\': \'pointer\'}], strcache: [{\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x2828280029293428\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x2d29656d616e2828\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x295f65756c61763e\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x74743e2d2963672e\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x4630783020262029\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x760034203d3d2029\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x5461756c2064696f\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x284d546c6c61635f\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x746174535f61756c\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x6e6f63202c2a2065\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x756c615654207473\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x6e6f63202c2a2065\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x756c615654207473\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x6e6f63202c2a2065\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x756c615654207473\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x6e6f63202c2a2065\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x756c615654207473\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x696f7600292a2065\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x635f5461756c2064\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x7365724d546c6c61\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x6174535f61756c28\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x6f63202c2a206574\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x6c6156542074736e\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x6f63202c2a206575\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x6c6156542074736e\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x6f63202c2a206575\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x6c6156542074736e\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x7453202c2a206575\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x726570002964496b\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x746962206d726f66\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x65706f2065736977\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x6f206e6f69746172\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x726f66726570006e\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x6d6874697261206d\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x6e6f2063697465\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x61756c2064696f76\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x7473756a64615f54\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x2873677261726176\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x746174535f61756c\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x746e69202c2a2065\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x6e496c6c6143202c\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x6f63202c2a206f66\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x746f72502074736e\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x3e2d4c00292a206f\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x3d3c20702e706f74\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x706f743e2d696320\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x696320262620702e\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x20702e706f743e2d\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x74733e2d4c203d3c\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x7473616c5f6b6361\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x2064696f7600702e\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x7465675f5461756c\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x2873677261726176\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x746174535f61756c\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x6c6143202c2a2065\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x2c2a206f666e496c\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x202c64496b745320\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x29746e69\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NULL\', \'type\': None, \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x6174616472657375\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NULL\', \'type\': None, \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x585868\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x5855d6\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x585871\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x585c20 <udatatypename>\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x58ba08\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x588a33\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x585879\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x57f313\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x585c20 <udatatypename>\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x57e4b0\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x5802c5\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x58587f\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x585885\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x58588d\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x58069d\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x585898\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x58589f\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x5858a5\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x5858aa\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x5858b0\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x5858b6\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x5858bc\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x5858c2\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x5858c8\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x5858ce\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x5858d5\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x5858dc\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x5858e2\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x5858e9\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x5858ef\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x5858f5\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x5858fb\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x585902\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x585907\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x58590c\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x585915\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x58591c\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x512362 <loadConstants+402>\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x51237f <loadConstants+431>\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x512765 <loadConstants+1429>\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x5123ef <loadConstants+543>\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x51234d <loadConstants+381>\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x512765 <loadConstants+1429>\', \'@@\': \'pointer\'}], \'@@\': \'array\'}, {\'@\': \'ARRAY\', \'type\': None, \'value\': [{\'@\': \'NESTED\', \'type\': None, \'value\': \'0x512765 <loadConstants+1429>\', \'@@\': \'pointer\'}, {\'@\': \'NESTED\', \'type\': None, \'value\': \'0x512765 <loadConstants+1429>\', \'@@\': \'pointer\'}], \'@@\': \'array\'}], warnf: 0x512765 <loadConstants+1429>, ud_warn: VOID}, ci: NULL, stack_last: {p: NULL, offset: 0}, stack: {p: NULL, offset: 0}, openupval: error, tbclist: {p: NULL, offset: 0}, gclist: NULL, twups: NULL, errorJmp: error, base_ci: {func: {p: 0x7ffff7e20c90, offset: 140737352174736}, top: {p: 0x7ffff7e20c90, offset: 140737352174736}, previous: error, next: error, u: {l: {savedpc: error, trap: 1664497459, nextraargs: 912613940}, c: {k = 0x3961343535363034, old_errfunc = 3919647027838203699, ctx = 12388}}, u2: {funcidx: 0, nyield: 0, nres: 0, transferinfo: {ftransfer = 0, ntransfer = 0}}, nresults: 0, callstatus: 0}, hook: 0x50, errfunc: 80, nCcalls: 16095360, oldpc: 0, basehookcount: 1714761573, hookcount: 845570914, hookmask: 942683192}', 'str': '0x4f1f8b <luaM_malloc_+299> "H\\213E\\240H\\203\\370"', 'l': '140737488346112'}

Output: {'type': 'unsigned int', 'value': '1174080900'}


int luaD_closeprotected (lua_State *L, ptrdiff_t level, int status) {
  CallInfo *old_ci = L->ci;
  lu_byte old_allowhooks = L->allowhook;
  for (;;) {
    struct CloseP pcl;
    pcl.level = restorestack(L, level); pcl.status = status;
    status = luaD_rawrunprotected(L, &closepaux, &pcl);
    if (l_likely(status == LUA_OK))
      return pcl.status;
    else {
      L->ci = old_ci;
      L->allowhook = old_allowhooks;
    }
  }
}

Input: {'L': "{next: error, tt: 15 '\\017', marked: 140 '\\214', status: 21 '\\025', allowhook: 0 '\\000', nci: 0, top: {p: 0x880104005df6f625, offset: -8646625409951664603}, l_G: error, ci: error, stack_last: {p: 0xfd8453b4840408b, offset: 1141738626455978123}, stack: {p: 0x25048a0000001583, offset: 2667408611914814851}, openupval: error, tbclist: {p: 0x8ce9005df6f725, offset: 39662684525229861}, gclist: error, twups: error, errorJmp: error, base_ci: {func: {p: 0xffffff7c858bfff7, offset: -564695138313}, top: {p: 0x58d0ffff883, offset: 6103416961155}, previous: error, next: error, u: {l: {savedpc: error, trap: 5753917, nextraargs: 0}, c: {k = 0xbf48005df6f82504, old_errfunc = 5753917, ctx = 377040191048}}, u2: {funcidx: -742785024, nyield: -742785024, nres: -742785024, transferinfo: {ftransfer = 0, ntransfer = 54202}}, nresults: 0, callstatus: 18432}, hook: 0x57cb6fb9, errfunc: 327355348014983168, nCcalls: 1576466725, oldpc: -2013199360, basehookcount: -151444220, hookcount: -1958215587, hookmask: -1958152067}", 'level': '140737488346800', 'status': '0'}

Output: {'type': 'int', 'value': '0'}


static int
header_read (SF_PRIVATE *psf, void *ptr, int bytes)
{	int count = 0 ;

	if (psf->header.indx + bytes >= psf->header.len && psf_bump_header_allocation (psf, bytes))
		return count ;

	if (psf->header.indx + bytes > psf->header.end)
	{	count = psf_fread (psf->header.ptr + psf->header.end, 1, bytes - (psf->header.end - psf->header.indx), psf) ;
		if (count != bytes - (int) (psf->header.end - psf->header.indx))
		{	psf_log_printf (psf, "Error : psf_fread returned short count.\n") ;
			return count ;
			} ;
		psf->header.end += count ;
		} ;

	memcpy (ptr, psf->header.ptr + psf->header.indx, bytes) ;
	psf->header.indx += bytes ;

	return bytes ;
}

Output: {'type': 'long', 'value': '0'}


int sldns_wire2str_edns_subnet_print(char** s, size_t* sl, uint8_t* data,
	size_t len)
{
	int w = 0;
	uint16_t family;
	uint8_t source, scope;
	if(len < 4) {
		w += sldns_str_print(s, sl, "malformed subnet ");
		w += print_hex_buf(s, sl, data, len);
		return w;
	}
	family = sldns_read_uint16(data);
	source = data[2];
	scope = data[3];
	if(family == 1) {

		char buf[64];
		uint8_t ip4[4];
		memset(ip4, 0, sizeof(ip4));
		if(len-4 > 4) {
			w += sldns_str_print(s, sl, "trailingdata:");
			w += print_hex_buf(s, sl, data+4+4, len-4-4);
			w += sldns_str_print(s, sl, " ");
			len = 4+4;
		}
		memmove(ip4, data+4, len-4);
		if(!inet_ntop(AF_INET, ip4, buf, (socklen_t)sizeof(buf))) {
			w += sldns_str_print(s, sl, "ip4ntoperror ");
			w += print_hex_buf(s, sl, data+4+4, len-4-4);
		} else {
			w += sldns_str_print(s, sl, "%s", buf);
		}
	} else if(family == 2) {

		char buf[64];
		uint8_t ip6[16];
		memset(ip6, 0, sizeof(ip6));
		if(len-4 > 16) {
			w += sldns_str_print(s, sl, "trailingdata:");
			w += print_hex_buf(s, sl, data+4+16, len-4-16);
			w += sldns_str_print(s, sl, " ");
			len = 4+16;
		}
		memmove(ip6, data+4, len-4);
#ifdef AF_INET6
		if(!inet_ntop(AF_INET6, ip6, buf, (socklen_t)sizeof(buf))) {
			w += sldns_str_print(s, sl, "ip6ntoperror ");
			w += print_hex_buf(s, sl, data+4+4, len-4-4);
		} else {
			w += sldns_str_print(s, sl, "%s", buf);
		}
#else
		w += print_hex_buf(s, sl, data+4+4, len-4-4);
#endif
	} else {

		w += sldns_str_print(s, sl, "family %d ",
			(int)family);
		w += print_hex_buf(s, sl, data, len);
	}
	w += sldns_str_print(s, sl, "/%d scope /%d", (int)source, (int)scope);
	return w;
}

Input: {'s': 'error', 'sl': '631774194886937417', 'data': 'NULL', 'len': '8213360'}

Output: {'type': 'int', 'value': '17'}


static int print_hex_buf(char** s, size_t* slen, uint8_t* buf, size_t len)
{
	const char* hex = "0123456789ABCDEF";
	size_t i;
	for(i=0; i<len; i++) {
		(void)sldns_str_print(s, slen, "%c%c", hex[(buf[i]&0xf0)>>4],
			hex[buf[i]&0x0f]);
	}
	return (int)len*2;
}

Input: {'s': 'NULL', 'slen': '0', 'buf': '0x721c32 "malformed subnet "', 'len': '73014444035'}

Output: {'type': 'int', 'value': '2'}


int sldns_wire2str_edns_n3u_print(char** s, size_t* sl, uint8_t* data,
	size_t len)
{
	size_t i;
	int w = 0;
	for(i=0; i<len; i++) {
		if(data[i] == 1)
			w += sldns_str_print(s, sl, " SHA1");
		else 	w += sldns_str_print(s, sl, " %d", (int)data[i]);
	}
	return w;
}

Input: {'s': 'error', 'sl': '20757632', 'data': '0x7fffffffde40 "\\003"', 'len': '18785137'}

Output: {'type': 'int', 'value': '3'}


int sldns_wire2str_edns_nsid_print(char** s, size_t* sl, uint8_t* data,
	size_t len)
{
	int w = 0;
	size_t i, printed=0;
	w += print_hex_buf(s, sl, data, len);
	for(i=0; i<len; i++) {
		if(isprint((unsigned char)data[i]) || data[i] == '\t') {
			if(!printed) {
				w += sldns_str_print(s, sl, " (");
				printed = 1;
			}
			w += sldns_str_print(s, sl, "%c", (char)data[i]);
		}
	}
	if(printed)
		w += sldns_str_print(s, sl, ")");
	return w;
}

Input: {'s': '0x13cbc80 " R"', 'sl': '3', 'data': '0x11ea371 "\\n\\003\\367\\377\\177"', 'len': '2'}

Output: {'type': 'int', 'value': '4'}


int sldns_wire2str_edns_ul_print(char** s, size_t* sl, uint8_t* data,
	size_t len)
{
	uint32_t lease;
	int w = 0;
	if(len != 4) {
		w += sldns_str_print(s, sl, "malformed UL ");
		w += print_hex_buf(s, sl, data, len);
		return w;
	}
	lease = sldns_read_uint32(data);
	w += sldns_str_print(s, sl, "lease %lu", (unsigned long)lease);
	return w;
}

Input: {'s': '0x3 <error: Cannot access memory at address 0x3>', 'sl': '8070451082003153674', 'data': '0x2 <error: Cannot access memory at address 0x2>', 'len': '17188144160'}

Output: {'type': 'int', 'value': '4'}


int sldns_wire2str_edns_llq_print(char** s, size_t* sl, uint8_t* data,
	size_t len)
{

	const char* llq_errors[] = {"NO-ERROR", "SERV-FULL", "STATIC",
		"FORMAT-ERR", "NO-SUCH-LLQ", "BAD-VERS", "UNKNOWN_ERR"};
	const unsigned int llq_errors_num = 7;
	const char* llq_opcodes[] = {"LLQ-SETUP", "LLQ-REFRESH", "LLQ-EVENT"};
	const unsigned int llq_opcodes_num = 3;
	uint16_t version, llq_opcode, error_code;
	uint64_t llq_id;
	uint32_t lease_life;
	int w = 0;

	if(len != 18) {
		w += sldns_str_print(s, sl, "malformed LLQ ");
		w += print_hex_buf(s, sl, data, len);
		return w;
	}
	version = sldns_read_uint16(data);
	llq_opcode = sldns_read_uint16(data+2);
	error_code = sldns_read_uint16(data+4);
	memmove(&llq_id, data+6, sizeof(llq_id));
	lease_life = sldns_read_uint32(data+14);

	w += sldns_str_print(s, sl, "v%d ", (int)version);
	if(llq_opcode < llq_opcodes_num)
		w += sldns_str_print(s, sl, "%s", llq_opcodes[llq_opcode]);
	else	w += sldns_str_print(s, sl, "opcode %d", (int)llq_opcode);
	if(error_code < llq_errors_num)
		w += sldns_str_print(s, sl, " %s", llq_errors[error_code]);
	else	w += sldns_str_print(s, sl, " error %d", (int)error_code);
#ifndef USE_WINSOCK
	w += sldns_str_print(s, sl, " id %llx lease-life %lu",
		(unsigned long long)llq_id, (unsigned long)lease_life);
#else
	w += sldns_str_print(s, sl, " id %I64x lease-life %lu",
		(unsigned long long)llq_id, (unsigned long)lease_life);
#endif
	return w;
}

Input: {'s': '0x13cbc80 "ma"', 'sl': '3', 'data': '0x11ea371 "\\n\\003\\367\\377\\177"', 'len': '2'}

Output: {'type': 'int', 'value': '4'}


static int Parser_isNameChar(

	int c,

	int bNameChar)
{
	if (Parser_isCharInTable(c, Letter, (int)LETTERTABLESIZE)) {
		return 1;
	}

	if (bNameChar &&
		Parser_isCharInTable(c, NameChar, (int)NAMECHARTABLESIZE)) {
		return 1;
	}

	return 0;
}

Input: {'c': '15508272', 'bNameChar': '0'}

Output: {'type': 'int', 'value': '1'}


static int Parser_copyToken(

	Parser *xmlParser,

	const char *src,

	ptrdiff_t len)
{
	int ret = IXML_SUCCESS;
	int line = 0;
	int i;
	int c;
	ptrdiff_t cl;
	const char *psrc;
	const char *pend;
	utf8char uch;

	if (!src || len <= 0) {
		line = __LINE__;
		ret = IXML_FAILED;
		goto ExitFunction;
	}

	psrc = src;
	pend = src + len;

	while (psrc < pend) {
		c = Parser_getChar(psrc, &cl);
		if (c <= 0) {
			line = __LINE__;
			ret = IXML_FAILED;
			goto ExitFunction;
		}

		if (cl == 1) {
			Parser_appendTokBufChar(xmlParser, (char)c);
			psrc++;
		} else {
			i = Parser_intToUTF8(c, uch);
			if (i == 0) {
				line = __LINE__;
				ret = IXML_FAILED;
				goto ExitFunction;
			}
			Parser_appendTokBufStr(xmlParser, uch);
			psrc += cl;
		}
	}

	if (psrc > pend) {
		line = __LINE__;
		ret = IXML_FAILED;
		goto ExitFunction;
	}

ExitFunction:
	if (ret != IXML_SUCCESS) {
		IxmlPrintf(
			__FILE__, line, "Parser_copyToken", "Error %d\n", ret);
	}

	return ret;
}

Input: {'xmlParser': 'error', 'src': '0xeca3b1 "pxm v\\375\\375\\202t"', 'len': '140737488345520'}

Output: {'type': 'int', 'value': '60'}


int ixml_membuf_insert(

	ixml_membuf *m,

	const void *buf,

	size_t buf_len,

	size_t index)
{
	int return_code = 0;

	assert(m != NULL);

	if (index > m->length) {
		return IXML_INDEX_SIZE_ERR;
	}

	if (buf == NULL || buf_len == (size_t)0) {
		return 0;
	}

	return_code = ixml_membuf_set_size(m, m->length + buf_len);
	if (return_code != 0) {
		return return_code;
	}

	memmove(m->buf + index + buf_len, m->buf + index, m->length - index);
	memcpy(m->buf + index, buf, buf_len);
	m->length += buf_len;

	m->buf[m->length] = 0;

	return 0;
}

Input: {'m': 'error', 'buf': 'NULL', 'buf_len': '257698037760', 'index': '0'}

Output: {'type': 'int', 'value': '0'}


static int Parser_appendTokBufChar(

	Parser *xmlParser,

	char c)
{
	int rc;

	rc = ixml_membuf_append(&(xmlParser->tokenBuf), &c);
	return rc;
}

Input: {'xmlParser': '{dataBuffer: 0xfdfd76206d78703c <error: Cannot access memory at address 0xfdfd76206d78703c>, curPtr: 0x7ffff7007482 "", savePtr: 0x20 <error: Cannot access memory at address 0x20>, lastElem: {buf: 0x311 <error: Cannot access memory at address 0x311>, length: 0, capacity: 15396880, size_inc: 0}, tokenBuf: {buf: NULL, length: 0, capacity: 0, size_inc: 0}, pNeedPrefixNode: NULL, pCurElement: NULL, currentNodePtr: NULL, state: eELEMENT, bHasTopLevel: 0}', 'c': "0 '\\000'"}

Output: {'type': 'int', 'value': '0'}


int ixml_membuf_assign(ixml_membuf *m, const void *buf, size_t buf_len)
{
	int return_code;

	assert(m != NULL);

	if (buf == NULL) {
		ixml_membuf_destroy(m);
		return IXML_SUCCESS;
	}

	return_code = ixml_membuf_set_size(m, buf_len);
	if (return_code != 0) {
		return return_code;
	}

	memcpy(m->buf, buf, buf_len);

	m->buf[buf_len] = 0;
	m->length = buf_len;

	return IXML_SUCCESS;
}

Input: {'m': 'error', 'buf': 'NULL', 'buf_len': '0'}

Output: {'type': 'int', 'value': '0'}


static errcode_t unix_open(const char *name, int flags,
			   io_channel *channel)
{
	int fd = -1;
	int open_flags;

	if (name == 0)
		return EXT2_ET_BAD_DEVICE_NAME;

	open_flags = (flags & IO_FLAG_RW) ? O_RDWR : O_RDONLY;
	if (flags & IO_FLAG_EXCLUSIVE)
		open_flags |= O_EXCL;
#if defined(O_DIRECT)
	if (flags & IO_FLAG_DIRECT_IO)
		open_flags |= O_DIRECT;
#endif
	fd = ext2fs_open_file(name, open_flags, 0);
	if (fd < 0)
		return errno;
#if defined(F_NOCACHE) && !defined(IO_DIRECT)
	if (flags & IO_FLAG_DIRECT_IO) {
		if (fcntl(fd, F_NOCACHE, 1) < 0)
			return errno;
	}
#endif
	return unix_open_channel(name, fd, flags, channel, unix_io_manager);
}

Input: {'name': 'NULL', 'flags': '0', 'channel': '0x65732f636f72702f'}

Output: {'type': 'int', 'value': '4'}


errcode_t ext2fs_open2(const char *name, const char *io_options,
		       int flags, int superblock,
		       unsigned int block_size, io_manager manager,
		       ext2_filsys *ret_fs)
{
	ext2_filsys	fs;
	errcode_t	retval;
	unsigned long	i, first_meta_bg;
	__u32		features;
	unsigned int	blocks_per_group, io_flags;
	blk64_t		group_block, blk;
	char		*dest, *cp;
	int		group_zero_adjust = 0;
	unsigned int	inode_size;
	__u64		groups_cnt;
#ifdef WORDS_BIGENDIAN
	unsigned int	groups_per_block;
	struct ext2_group_desc *gdp;
	int		j;
#endif
	char		*time_env;
	int		csum_retries = 0;

	EXT2_CHECK_MAGIC(manager, EXT2_ET_MAGIC_IO_MANAGER);

	retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs);
	if (retval)
		return retval;

	memset(fs, 0, sizeof(struct struct_ext2_filsys));
	fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS;
	fs->flags = flags;

	fs->flags |= EXT2_FLAG_MASTER_SB_ONLY;
	fs->umask = 022;

	time_env = getenv("E2FSPROGS_FAKE_TIME");
	if (time_env)
		fs->now = strtoul(time_env, NULL, 0);

	retval = ext2fs_get_mem(strlen(name)+1, &fs->device_name);
	if (retval)
		goto cleanup;
	strcpy(fs->device_name, name);
	cp = strchr(fs->device_name, '?');
	if (!io_options && cp) {
		*cp++ = 0;
		io_options = cp;
	}

	io_flags = 0;
	if (flags & EXT2_FLAG_RW)
		io_flags |= IO_FLAG_RW;
	if (flags & EXT2_FLAG_EXCLUSIVE)
		io_flags |= IO_FLAG_EXCLUSIVE;
	if (flags & EXT2_FLAG_DIRECT_IO)
		io_flags |= IO_FLAG_DIRECT_IO;
	if (flags & EXT2_FLAG_THREADS)
		io_flags |= IO_FLAG_THREADS;
	retval = manager->open(fs->device_name, io_flags, &fs->io);
	if (retval)
		goto cleanup;
	if (io_options &&
	    (retval = io_channel_set_options(fs->io, io_options)))
		goto cleanup;
	fs->image_io = fs->io;
	fs->io->app_data = fs;
	retval = io_channel_alloc_buf(fs->io, -SUPERBLOCK_SIZE, &fs->super);
	if (retval)
		goto cleanup;
	if (flags & EXT2_FLAG_IMAGE_FILE) {
		retval = ext2fs_get_mem(sizeof(struct ext2_image_hdr),
					&fs->image_header);
		if (retval)
			goto cleanup;
		retval = io_channel_read_blk(fs->io, 0,
					     -(int)sizeof(struct ext2_image_hdr),
					     fs->image_header);
		if (retval)
			goto cleanup;
		if (ext2fs_le32_to_cpu(fs->image_header->magic_number) != EXT2_ET_MAGIC_E2IMAGE)
			return EXT2_ET_MAGIC_E2IMAGE;
		superblock = 1;
		block_size = ext2fs_le32_to_cpu(fs->image_header->fs_blocksize);
	}

	if (superblock) {
		if (!block_size) {
			retval = EXT2_ET_INVALID_ARGUMENT;
			goto cleanup;
		}
		io_channel_set_blksize(fs->io, block_size);
		group_block = superblock;
		fs->orig_super = 0;
	} else {
		io_channel_set_blksize(fs->io, SUPERBLOCK_OFFSET);
		superblock = 1;
		group_block = 0;
		retval = ext2fs_get_mem(SUPERBLOCK_SIZE, &fs->orig_super);
		if (retval)
			goto cleanup;
	}
retry:
	retval = io_channel_read_blk(fs->io, superblock, -SUPERBLOCK_SIZE,
				     fs->super);
	if (retval)
		goto cleanup;
	if (fs->orig_super)
		memcpy(fs->orig_super, fs->super, SUPERBLOCK_SIZE);

	if (!(fs->flags & EXT2_FLAG_IGNORE_CSUM_ERRORS)) {
		retval = 0;
		if (!ext2fs_verify_csum_type(fs, fs->super))
			retval = EXT2_ET_UNKNOWN_CSUM;
		if (!ext2fs_superblock_csum_verify(fs, fs->super)) {
			if (csum_retries++ < 3)
				goto retry;
			retval = EXT2_ET_SB_CSUM_INVALID;
		}
	}

#ifdef WORDS_BIGENDIAN
	fs->flags |= EXT2_FLAG_SWAP_BYTES;
	ext2fs_swap_super(fs->super);
#else
	if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
		retval = EXT2_ET_UNIMPLEMENTED;
		goto cleanup;
	}
#endif

	if (fs->super->s_magic != EXT2_SUPER_MAGIC)
		retval = EXT2_ET_BAD_MAGIC;
	if (retval)
		goto cleanup;

	if (fs->super->s_rev_level > EXT2_LIB_CURRENT_REV) {
		retval = EXT2_ET_REV_TOO_HIGH;
		goto cleanup;
	}

	if (!(flags & EXT2_FLAG_FORCE)) {
		features = fs->super->s_feature_incompat;
#ifdef EXT2_LIB_SOFTSUPP_INCOMPAT
		if (flags & EXT2_FLAG_SOFTSUPP_FEATURES)
			features &= ~EXT2_LIB_SOFTSUPP_INCOMPAT;
#endif
		if (features & ~EXT2_LIB_FEATURE_INCOMPAT_SUPP) {
			retval = EXT2_ET_UNSUPP_FEATURE;
			goto cleanup;
		}

		features = fs->super->s_feature_ro_compat;
#ifdef EXT2_LIB_SOFTSUPP_RO_COMPAT
		if (flags & EXT2_FLAG_SOFTSUPP_FEATURES)
			features &= ~EXT2_LIB_SOFTSUPP_RO_COMPAT;
#endif
		if ((flags & EXT2_FLAG_RW) &&
		    (features & ~EXT2_LIB_FEATURE_RO_COMPAT_SUPP)) {
			retval = EXT2_ET_RO_UNSUPP_FEATURE;
			goto cleanup;
		}

		if (!(flags & EXT2_FLAG_JOURNAL_DEV_OK) &&
		    ext2fs_has_feature_journal_dev(fs->super)) {
			retval = EXT2_ET_UNSUPP_FEATURE;
			goto cleanup;
		}
	}

	if ((fs->super->s_log_block_size >
	     (unsigned) (EXT2_MAX_BLOCK_LOG_SIZE - EXT2_MIN_BLOCK_LOG_SIZE)) ||
	    (fs->super->s_log_cluster_size >
	     (unsigned) (EXT2_MAX_CLUSTER_LOG_SIZE - EXT2_MIN_CLUSTER_LOG_SIZE)) ||
	    (fs->super->s_log_block_size > fs->super->s_log_cluster_size) ||
	    (fs->super->s_log_groups_per_flex > 31)) {
		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
		goto cleanup;
	}

	if (ext2fs_has_feature_bigalloc(fs->super) &&
	    !(flags & EXT2_FLAG_64BITS)) {
		retval = EXT2_ET_CANT_USE_LEGACY_BITMAPS;
		goto cleanup;
	}

	if (!ext2fs_has_feature_bigalloc(fs->super) &&
	    (fs->super->s_log_block_size != fs->super->s_log_cluster_size)) {
		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
		goto cleanup;
	}
	fs->fragsize = fs->blocksize = EXT2_BLOCK_SIZE(fs->super);
	inode_size = EXT2_INODE_SIZE(fs->super);
	if ((inode_size < EXT2_GOOD_OLD_INODE_SIZE) ||
	    (inode_size > fs->blocksize) ||
	    (inode_size & (inode_size - 1))) {
		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
		goto cleanup;
	}

	if (!(flags & EXT2_FLAG_IGNORE_SB_ERRORS) &&
	    ext2fs_has_feature_64bit(fs->super)) {
		unsigned desc_size = fs->super->s_desc_size;

		if ((desc_size < EXT2_MIN_DESC_SIZE_64BIT) ||
		    (desc_size > EXT2_MAX_DESC_SIZE) ||
		    (desc_size & (desc_size - 1)) != 0) {
			retval = EXT2_ET_BAD_DESC_SIZE;
			goto cleanup;
		}
	}

	fs->cluster_ratio_bits = fs->super->s_log_cluster_size -
		fs->super->s_log_block_size;
	if (EXT2_BLOCKS_PER_GROUP(fs->super) !=
	    EXT2_CLUSTERS_PER_GROUP(fs->super) << fs->cluster_ratio_bits) {
		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
		goto cleanup;
	}
	fs->inode_blocks_per_group = ((EXT2_INODES_PER_GROUP(fs->super) *
				       EXT2_INODE_SIZE(fs->super) +
				       EXT2_BLOCK_SIZE(fs->super) - 1) /
				      EXT2_BLOCK_SIZE(fs->super));
	if (block_size) {
		if (block_size != fs->blocksize) {
			retval = EXT2_ET_UNEXPECTED_BLOCK_SIZE;
			goto cleanup;
		}
	}

	io_channel_set_blksize(fs->io, fs->blocksize);

	if (ext2fs_has_feature_journal_dev(fs->super)) {
		fs->group_desc_count = 0;
		*ret_fs = fs;
		return 0;
	}

	if (EXT2_INODES_PER_GROUP(fs->super) == 0) {
		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
		goto cleanup;
	}

	ext2fs_init_csum_seed(fs);

	blocks_per_group = EXT2_BLOCKS_PER_GROUP(fs->super);
	if (blocks_per_group < 8 ||
	    blocks_per_group > EXT2_MAX_BLOCKS_PER_GROUP(fs->super) ||
	    fs->inode_blocks_per_group > EXT2_MAX_INODES_PER_GROUP(fs->super) ||
           EXT2_DESC_PER_BLOCK(fs->super) == 0 ||
           fs->super->s_first_data_block >= ext2fs_blocks_count(fs->super)) {
		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
		goto cleanup;
	}
	groups_cnt = ext2fs_div64_ceil(ext2fs_blocks_count(fs->super) -
				       fs->super->s_first_data_block,
				       blocks_per_group);
	if (groups_cnt >> 32) {
		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
		goto cleanup;
	}
	fs->group_desc_count = 	groups_cnt;
	if (!(flags & EXT2_FLAG_IGNORE_SB_ERRORS) &&
	    (__u64)fs->group_desc_count * EXT2_INODES_PER_GROUP(fs->super) !=
	    fs->super->s_inodes_count) {
		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
		goto cleanup;
	}
	fs->desc_blocks = ext2fs_div_ceil(fs->group_desc_count,
					  EXT2_DESC_PER_BLOCK(fs->super));
	if (ext2fs_has_feature_meta_bg(fs->super) &&
	    (fs->super->s_first_meta_bg > fs->desc_blocks) &&
	    !(flags & EXT2_FLAG_IGNORE_SB_ERRORS)) {
		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
		goto cleanup;
	}
	if (flags & EXT2_FLAG_SUPER_ONLY)
		goto skip_read_bg;
	retval = ext2fs_get_array(fs->desc_blocks, fs->blocksize,
				&fs->group_desc);
	if (retval)
		goto cleanup;
	if (!group_block)
		group_block = fs->super->s_first_data_block;

	if (group_block == 0 && fs->blocksize == 1024)
		group_zero_adjust = 1;
	dest = (char *) fs->group_desc;
#ifdef WORDS_BIGENDIAN
	groups_per_block = EXT2_DESC_PER_BLOCK(fs->super);
#endif
	if (ext2fs_has_feature_meta_bg(fs->super) &&
	    !(flags & EXT2_FLAG_IMAGE_FILE)) {
		first_meta_bg = fs->super->s_first_meta_bg;
		if (first_meta_bg > fs->desc_blocks)
			first_meta_bg = fs->desc_blocks;
	} else
		first_meta_bg = fs->desc_blocks;
	if (first_meta_bg) {
		retval = io_channel_read_blk(fs->io, group_block +
					     group_zero_adjust + 1,
					     first_meta_bg, dest);
		if (retval)
			goto cleanup;
#ifdef WORDS_BIGENDIAN
		gdp = (struct ext2_group_desc *) dest;
		for (j=0; j < groups_per_block*first_meta_bg; j++) {
			gdp = ext2fs_group_desc(fs, fs->group_desc, j);
			if (gdp)
				ext2fs_swap_group_desc2(fs, gdp);
		}
#endif
		dest += fs->blocksize*first_meta_bg;
	}

	for (i = first_meta_bg ; i < fs->desc_blocks; i++) {
		blk = ext2fs_descriptor_block_loc2(fs, group_block, i);
		io_channel_cache_readahead(fs->io, blk, 1);
	}

	for (i=first_meta_bg ; i < fs->desc_blocks; i++) {
		blk = ext2fs_descriptor_block_loc2(fs, group_block, i);
		retval = io_channel_read_blk64(fs->io, blk, 1, dest);
		if (retval)
			goto cleanup;
#ifdef WORDS_BIGENDIAN
		for (j=0; j < groups_per_block; j++) {
			gdp = ext2fs_group_desc(fs, fs->group_desc,
						i * groups_per_block + j);
			if (gdp)
				ext2fs_swap_group_desc2(fs, gdp);
		}
#endif
		dest += fs->blocksize;
	}

	fs->stride = fs->super->s_raid_stride;

	if (superblock > 1 && ext2fs_has_group_desc_csum(fs)) {
		dgrp_t group;

		for (group = 0; group < fs->group_desc_count; group++) {
			ext2fs_bg_flags_clear(fs, group, EXT2_BG_BLOCK_UNINIT);
			ext2fs_bg_flags_clear(fs, group, EXT2_BG_INODE_UNINIT);
			ext2fs_bg_itable_unused_set(fs, group, 0);

			ext2fs_group_desc_csum_set(fs, group);
		}
		if (fs->flags & EXT2_FLAG_RW)
			ext2fs_mark_super_dirty(fs);
	}
skip_read_bg:
	if (ext2fs_has_feature_mmp(fs->super) &&
	    !(flags & EXT2_FLAG_SKIP_MMP) &&
	    (flags & (EXT2_FLAG_RW | EXT2_FLAG_EXCLUSIVE))) {
		retval = ext2fs_mmp_start(fs);
		if (retval) {
			fs->flags |= EXT2_FLAG_SKIP_MMP;
			ext2fs_mmp_stop(fs);
			goto cleanup;
		}
	}

	if (fs->flags & EXT2_FLAG_SHARE_DUP) {
		fs->block_sha_map = ext2fs_hashmap_create(ext2fs_djb2_hash,
					block_sha_map_free_entry, 4096);
		if (!fs->block_sha_map) {
			retval = EXT2_ET_NO_MEMORY;
			goto cleanup;
		}
		ext2fs_set_feature_shared_blocks(fs->super);
	}

	if (ext2fs_has_feature_casefold(fs->super))
		fs->encoding = ext2fs_load_nls_table(fs->super->s_encoding);

	fs->flags &= ~EXT2_FLAG_NOFREE_ON_ERROR;
	*ret_fs = fs;

	return 0;
cleanup:
	if (!(flags & EXT2_FLAG_NOFREE_ON_ERROR)) {
		ext2fs_free(fs);
		fs = NULL;
	}
	*ret_fs = fs;
	return retval;
}

Input: {'name': '0x7fffffffdeb8 "\\036/proc/self/fd/3"', 'io_options': '0x7fffffffdeb9 "/proc/self/fd/3"', 'flags': '32767', 'superblock': '-8736', 'block_size': '0', 'manager': '0x7fffffffddd0', 'ret_fs': '0x732f636f72702f1e'}

{'flags': {'type': 'int', 'value': '32767'}, 'superblock': {'type': 'int', 'value': '-8736'}, 'block_size': {'type': 'unsigned int', 'value': '0'}}

Output: {'type': 'long', 'value': '0'}


static errcode_t unix_read_blk64(io_channel channel, unsigned long long block,
			       int count, void *buf)
{
	struct unix_private_data *data;
	struct unix_cache *cache;
	errcode_t	retval;
	char		*cp;
	int		i, j;

	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
	data = (struct unix_private_data *) channel->private_data;
	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);

#ifdef NO_IO_CACHE
	return raw_read_blk(channel, data, block, count, buf);
#else
	if (data->flags & IO_FLAG_NOCACHE)
		return raw_read_blk(channel, data, block, count, buf);

	if (count < 0 || count > WRITE_DIRECT_SIZE) {
		if ((retval = flush_cached_blocks(channel, data, 0)))
			return retval;
		return raw_read_blk(channel, data, block, count, buf);
	}

	cp = buf;
	mutex_lock(data, CACHE_MTX);
	while (count > 0) {

		if ((cache = find_cached_block(data, block, NULL))) {
#ifdef DEBUG
			printf("Using cached block %lu\n", block);
#endif
			memcpy(cp, cache->buf, channel->block_size);
			count--;
			block++;
			cp += channel->block_size;
			continue;
		}

		for (i=1; i < count; i++)
			if (find_cached_block(data, block+i, NULL))
				break;
#ifdef DEBUG
		printf("Reading %d blocks starting at %lu\n", i, block);
#endif
		mutex_unlock(data, CACHE_MTX);
		if ((retval = raw_read_blk(channel, data, block, i, cp)))
			return retval;
		mutex_lock(data, CACHE_MTX);

		for (j=0; j < i; j++) {
			if (!find_cached_block(data, block, &cache)) {
				retval = reuse_cache(channel, data,
						     cache, block);
				if (retval)
					goto call_write_handler;
				memcpy(cache->buf, cp, channel->block_size);
			}
			count--;
			block++;
			cp += channel->block_size;
		}
	}
	mutex_unlock(data, CACHE_MTX);
	return 0;

call_write_handler:
	if (cache->write_err && channel->write_error) {
		char *err_buf = NULL;
		unsigned long long err_block = cache->block;

		cache->dirty = 0;
		cache->in_use = 0;
		cache->write_err = 0;
		if (io_channel_alloc_buf(channel, 0, &err_buf))
			err_buf = NULL;
		else
			memcpy(err_buf, cache->buf, channel->block_size);
		mutex_unlock(data, CACHE_MTX);
		(channel->write_error)(channel, err_block, 1, err_buf,
				       channel->block_size, -1,
				       retval);
		if (err_buf)
			ext2fs_free_mem(&err_buf);
	} else
		mutex_unlock(data, CACHE_MTX);
	return retval;
#endif
}

Input: {'channel': '0x1016b70', 'block': '16875632', 'count': '0', 'buf': 'NULL'}

{'block': {'type': 'unsigned long long', 'value': '16875632'}, 'count': {'type': 'int', 'value': '0'}}

Output: {'type': 'long', 'value': '0'}


static int parse_value(const char **sp, JsonNode **out, unsigned int depth)
{
	const char *s = *sp;

	if (depth > CCAN_JSON_MAX_DEPTH) {
		return FALSE;
	}

	switch (*s) {
		case 'n':
			if (expect_literal(&s, "null")) {
				if (out)
					*out = json_mknull();
				*sp = s;
				return TRUE;
			}
			return FALSE;

		case 'f':
			if (expect_literal(&s, "false")) {
				if (out)
					*out = json_mkbool(FALSE);
				*sp = s;
				return TRUE;
			}
			return FALSE;

		case 't':
			if (expect_literal(&s, "true")) {
				if (out)
					*out = json_mkbool(TRUE);
				*sp = s;
				return TRUE;
			}
			return FALSE;

		case '"': {
			char *str;
			if (parse_string(&s, out ? &str : NULL)) {
				if (out)
					*out = mkstring(str);
				*sp = s;
				return TRUE;
			}
			return FALSE;
		}

		case '[':
			if (parse_array(&s, out, depth)) {
				*sp = s;
				return TRUE;
			}
			return FALSE;

		case '{':
			if (parse_object(&s, out, depth)) {
				*sp = s;
				return TRUE;
			}
			return FALSE;

		default: {
			double num;
			if (parse_number(&s, out ? &num : NULL)) {
				if (out)
					*out = json_mknumber(num);
				*sp = s;
				return TRUE;
			}
			return FALSE;
		}
	}
}

Input: {'sp': '0x602e31 <get_default_chdir+225> "\\340\\351}"', 'out': 'error', 'depth': '49'}

{'depth': {'type': 'unsigned int', 'value': '49'}}

Output: {'type': 'int', 'value': '0'}


int pr_trace_msg(const char *channel, int level, const char *fmt, ...) {
  errno = ENOSYS;
  return -1;
}

Input: {'channel': '0x125ac00 "1.`"', 'level': '0', 'fmt': '0x7fffffffddc0 " \\336\\377\\377\\377\\177"', '...': 'NULL'}

Output: {'type': 'int', 'value': '0'}


char *tjLoadImage(const char *filename, int *width,
                                     int align, int *height, int *pixelFormat,
                                     int flags)
{
  int retval = 0, tempc;
  size_t pitch;
  tjhandle handle = NULL;
  tjinstance *this;
  j_compress_ptr cinfo = NULL;
  cjpeg_source_ptr src;
  unsigned char *dstBuf = NULL;
  FILE *file = NULL;
  boolean invert;

  if (!filename || !width || align < 1 || !height || !pixelFormat ||
      *pixelFormat < TJPF_UNKNOWN || *pixelFormat >= TJ_NUMPF)
    THROWG("tjLoadImage(): Invalid argument");
  if ((align & (align - 1)) != 0)
    THROWG("tjLoadImage(): Alignment must be a power of 2");

  if ((handle = tjInitCompress()) == NULL) return NULL;
  this = (tjinstance *)handle;
  cinfo = &this->cinfo;

#ifdef _MSC_VER
  if (fopen_s(&file, filename, "rb") || file == NULL)
#else
  if ((file = fopen(filename, "rb")) == NULL)
#endif
    THROW_UNIX("tjLoadImage(): Cannot open input file");

  if ((tempc = getc(file)) < 0 || ungetc(tempc, file) == EOF)
    THROW_UNIX("tjLoadImage(): Could not read input file")
  else if (tempc == EOF)
    THROWG("tjLoadImage(): Input file contains no data");

  if (setjmp(this->jerr.setjmp_buffer)) {

    retval = -1;  goto bailout;
  }

  if (*pixelFormat == TJPF_UNKNOWN) cinfo->in_color_space = JCS_UNKNOWN;
  else cinfo->in_color_space = pf2cs[*pixelFormat];
  if (tempc == 'B') {
    if ((src = jinit_read_bmp(cinfo, FALSE)) == NULL)
      THROWG("tjLoadImage(): Could not initialize bitmap loader");
    invert = (flags & TJFLAG_BOTTOMUP) == 0;
  } else if (tempc == 'P') {
    if ((src = jinit_read_ppm(cinfo)) == NULL)
      THROWG("tjLoadImage(): Could not initialize PPM loader");
    invert = (flags & TJFLAG_BOTTOMUP) != 0;
  } else
    THROWG("tjLoadImage(): Unsupported file type");

  src->input_file = file;
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION

  if (flags & TJFLAG_FUZZING)
    src->max_pixels = 1048576;
#endif
  (*src->start_input) (cinfo, src);
  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr)cinfo);

  *width = cinfo->image_width;  *height = cinfo->image_height;
  *pixelFormat = cs2pf[cinfo->in_color_space];

  pitch = PAD((*width) * tjPixelSize[*pixelFormat], align);
  if ((unsigned long long)pitch * (unsigned long long)(*height) >
      (unsigned long long)((size_t)-1) ||
      (dstBuf = (unsigned char *)malloc(pitch * (*height))) == NULL)
    THROWG("tjLoadImage(): Memory allocation failure");

  if (setjmp(this->jerr.setjmp_buffer)) {

    retval = -1;  goto bailout;
  }

  while (cinfo->next_scanline < cinfo->image_height) {
    int i, nlines = (*src->get_pixel_rows) (cinfo, src);

    for (i = 0; i < nlines; i++) {
      unsigned char *dstptr;
      int row;

      row = cinfo->next_scanline + i;
      if (invert) dstptr = &dstBuf[((*height) - row - 1) * pitch];
      else dstptr = &dstBuf[row * pitch];
      memcpy(dstptr, src->buffer[i], (*width) * tjPixelSize[*pixelFormat]);
    }
    cinfo->next_scanline += nlines;
  }

  (*src->finish_input) (cinfo, src);

bailout:
  if (handle) tjDestroy(handle);
  if (file) fclose(file);
  if (retval < 0) { free(dstBuf);  dstBuf = NULL; }
  return dstBuf;
}

Input: {'filename': '0x106b020 "\\240\\264\\006\\001"', 'width': '-8384', 'align': '32767', 'height': '-129660600', 'pixelFormat': '-8384', 'flags': '0'}

Output: {'type': 'int', 'value': '0'}


int     mime_state_update(MIME_STATE *state, int rec_type,
			          const char *text, ssize_t len)
{
    int     input_is_text = (rec_type == REC_TYPE_NORM
			     || rec_type == REC_TYPE_CONT);
    MIME_STACK *sp;
    const HEADER_OPTS *header_info;
    const unsigned char *cp;

#define SAVE_PREV_REC_TYPE_AND_RETURN_ERR_FLAGS(state, rec_type) do { \
	state->prev_rec_type = rec_type; \
	return (state->err_flags); \
    } while (0)

    if (!input_is_text && state->prev_rec_type == REC_TYPE_CONT)
	mime_state_update(state, REC_TYPE_NORM, "", 0);

    switch (state->curr_state) {

    case MIME_STATE_PRIMARY:
    case MIME_STATE_MULTIPART:
    case MIME_STATE_NESTED:
	if (LEN(state->output_buffer) > 0) {
	    if (input_is_text) {
		if (state->prev_rec_type == REC_TYPE_CONT) {
		    if (LEN(state->output_buffer) < var_header_limit) {
			vstring_strncat(state->output_buffer, text, len);
		    } else {
			if (state->static_flags & MIME_OPT_REPORT_TRUNC_HEADER)
			    REPORT_ERROR_BUF(state, MIME_ERR_TRUNC_HEADER,
					     state->output_buffer);
		    }
		    SAVE_PREV_REC_TYPE_AND_RETURN_ERR_FLAGS(state, rec_type);
		}
		if (IS_SPACE_TAB(*text)) {
		    if (LEN(state->output_buffer) < var_header_limit) {
			vstring_strcat(state->output_buffer, "\n");
			vstring_strncat(state->output_buffer, text, len);
		    } else {
			if (state->static_flags & MIME_OPT_REPORT_TRUNC_HEADER)
			    REPORT_ERROR_BUF(state, MIME_ERR_TRUNC_HEADER,
					     state->output_buffer);
		    }
		    SAVE_PREV_REC_TYPE_AND_RETURN_ERR_FLAGS(state, rec_type);
		}
	    }

	    if (LEN(state->output_buffer) > 0) {
		header_info = header_opts_find(STR(state->output_buffer));
		if (!(state->static_flags & MIME_OPT_DISABLE_MIME)
		    && header_info != 0) {
		    if (header_info->type == HDR_CONTENT_TYPE)
			mime_state_content_type(state, header_info);
		    if (header_info->type == HDR_CONTENT_TRANSFER_ENCODING)
			mime_state_content_encoding(state, header_info);
		}
		if ((state->static_flags & MIME_OPT_REPORT_8BIT_IN_HEADER) != 0
		    && (state->err_flags & MIME_ERR_8BIT_IN_HEADER) == 0) {
		    for (cp = CU_CHAR_PTR(STR(state->output_buffer));
			 cp < CU_CHAR_PTR(END(state->output_buffer)); cp++)
			if (*cp & 0200) {
			    REPORT_ERROR_BUF(state, MIME_ERR_8BIT_IN_HEADER,
					     state->output_buffer);
			    break;
			}
		}

		if (header_info == 0
		    || header_info->type != HDR_CONTENT_TRANSFER_ENCODING
		    || (state->static_flags & MIME_OPT_DOWNGRADE) == 0
		    || state->curr_domain == MIME_ENC_7BIT)
		    HEAD_OUT(state, header_info, len);
		state->prev_rec_type = 0;
		VSTRING_RESET(state->output_buffer);
	    }
	}

	if (input_is_text) {
	    ssize_t header_len;

	    if ((header_len = is_header_buf(text, len)) > 0) {
		vstring_strncpy(state->output_buffer, text, header_len);
		for (text += header_len, len -= header_len;
		     len > 0 && IS_SPACE_TAB(*text);
		     text++, len--)
		      ;
		vstring_strncat(state->output_buffer, text, len);
		SAVE_PREV_REC_TYPE_AND_RETURN_ERR_FLAGS(state, rec_type);
	    }
	}

	if ((state->static_flags & MIME_OPT_DOWNGRADE)
	    && state->curr_domain != MIME_ENC_7BIT) {
	    if ((state->curr_ctype == MIME_CTYPE_MESSAGE
		 && state->curr_stype != MIME_STYPE_GLOBAL)
		|| state->curr_ctype == MIME_CTYPE_MULTIPART)
		cp = CU_CHAR_PTR("7bit");
	    else
		cp = CU_CHAR_PTR("quoted-printable");
	    vstring_sprintf(state->output_buffer,
			    "Content-Transfer-Encoding: %s", cp);
	    HEAD_OUT(state, (HEADER_OPTS *) 0, len);
	    VSTRING_RESET(state->output_buffer);
	}

	if (state->curr_state == MIME_STATE_PRIMARY && state->head_end)
	    state->head_end(state->app_context);

	if (state->static_flags & MIME_OPT_REPORT_ENCODING_DOMAIN) {
	    if (state->curr_ctype == MIME_CTYPE_MESSAGE) {
		if (state->curr_stype == MIME_STYPE_PARTIAL
		    || state->curr_stype == MIME_STYPE_EXTERN_BODY) {
		    if (state->curr_domain != MIME_ENC_7BIT)
			REPORT_ERROR(state, MIME_ERR_ENCODING_DOMAIN,
				 mime_state_enc_name(state->curr_encoding));
		}

		else if (state->curr_stype == MIME_STYPE_RFC822) {
		    if (state->curr_encoding != state->curr_domain)
			REPORT_ERROR(state, MIME_ERR_ENCODING_DOMAIN,
				 mime_state_enc_name(state->curr_encoding));
		}
	    } else if (state->curr_ctype == MIME_CTYPE_MULTIPART) {
		if (state->curr_encoding != state->curr_domain)
		    REPORT_ERROR(state, MIME_ERR_ENCODING_DOMAIN,
				 mime_state_enc_name(state->curr_encoding));
	    }
	}

	if (input_is_text) {
	    if (len == 0) {
		state->body_offset = 0;
		if (state->curr_ctype == MIME_CTYPE_MESSAGE) {
		    if (state->curr_stype == MIME_STYPE_RFC822)
			SET_MIME_STATE(state, MIME_STATE_NESTED,
				       MIME_CTYPE_TEXT, MIME_STYPE_PLAIN,
				       MIME_ENC_7BIT, MIME_ENC_7BIT);
		    else if (state->curr_stype == MIME_STYPE_GLOBAL
			 && ((state->static_flags & MIME_OPT_DOWNGRADE) == 0
			     || state->curr_domain == MIME_ENC_7BIT))

			SET_MIME_STATE(state, MIME_STATE_NESTED,
				       MIME_CTYPE_TEXT, MIME_STYPE_PLAIN,
				       MIME_ENC_7BIT, MIME_ENC_7BIT);
		    else
			SET_CURR_STATE(state, MIME_STATE_BODY);
		} else if (state->curr_ctype == MIME_CTYPE_MULTIPART) {
		    SET_MIME_STATE(state, MIME_STATE_BODY,
				   MIME_CTYPE_OTHER, MIME_STYPE_OTHER,
				   MIME_ENC_7BIT, MIME_ENC_7BIT);
		} else {
		    SET_CURR_STATE(state, MIME_STATE_BODY);
		}
	    }

	    else {
		if (msg_verbose)
		    msg_info("garbage in %s header",
		    state->curr_state == MIME_STATE_MULTIPART ? "multipart" :
		       state->curr_state == MIME_STATE_PRIMARY ? "primary" :
			 state->curr_state == MIME_STATE_NESTED ? "nested" :
			     "other");
		switch (state->curr_state) {
		case MIME_STATE_PRIMARY:
		    BODY_OUT(state, REC_TYPE_NORM, "", 0);
		    SET_CURR_STATE(state, MIME_STATE_BODY);
		    break;
#if 0
		case MIME_STATE_NESTED:
		    if (state->body_offset <= 1
			&& rec_type == REC_TYPE_NORM
			&& len > 7
			&& (strncmp(text + (*text == '>'), "From ", 5) == 0
			    || strncmp(text, "=46rom ", 7) == 0))
			break;

#endif
		default:
		    SET_CURR_STATE(state, MIME_STATE_BODY);
		    break;
		}
	    }
	}

	else {
	    SET_CURR_STATE(state, MIME_STATE_BODY);
	}

    case MIME_STATE_BODY:
	if (input_is_text) {
	    if ((state->static_flags & MIME_OPT_REPORT_8BIT_IN_7BIT_BODY) != 0
		&& state->curr_encoding == MIME_ENC_7BIT
		&& (state->err_flags & MIME_ERR_8BIT_IN_7BIT_BODY) == 0) {
		for (cp = CU_CHAR_PTR(text); cp < CU_CHAR_PTR(text + len); cp++)
		    if (*cp & 0200) {
			REPORT_ERROR_LEN(state, MIME_ERR_8BIT_IN_7BIT_BODY,
					 text, len);
			break;
		    }
	    }
	    if (state->stack && state->prev_rec_type != REC_TYPE_CONT
		&& len > 2 && text[0] == '-' && text[1] == '-') {
		for (sp = state->stack; sp != 0; sp = sp->next) {
		    if (len >= 2 + sp->bound_len &&
		      strncmp(text + 2, sp->boundary, sp->bound_len) == 0) {
			while (sp != state->stack)
			    mime_state_pop(state);
			if (len >= 4 + sp->bound_len &&
			  strncmp(text + 2 + sp->bound_len, "--", 2) == 0) {
			    mime_state_pop(state);
			    SET_MIME_STATE(state, MIME_STATE_BODY,
					 MIME_CTYPE_OTHER, MIME_STYPE_OTHER,
					   MIME_ENC_7BIT, MIME_ENC_7BIT);
			} else {
			    SET_MIME_STATE(state, MIME_STATE_MULTIPART,
					   sp->def_ctype, sp->def_stype,
					   MIME_ENC_7BIT, MIME_ENC_7BIT);
			}
			break;
		    }
		}
	    }

	    if ((state->static_flags & MIME_OPT_DOWNGRADE)
		&& state->curr_domain != MIME_ENC_7BIT)
		mime_state_downgrade(state, rec_type, text, len);
	    else
		BODY_OUT(state, rec_type, text, len);
	}

	else {
	    if (state->body_end)
		state->body_end(state->app_context);
	}
	SAVE_PREV_REC_TYPE_AND_RETURN_ERR_FLAGS(state, rec_type);

    default:
	msg_panic("mime_state_update: unknown state: %d", state->curr_state);
    }
}

Input: {'state': 'NULL', 'rec_type': '<optimized out>', 'text': '<optimized out>', 'len': '<optimized out>'}

{'rec_type': {'type': 'int', 'value': '<optimized out>'}}

Output: {'type': 'long', 'value': '0'}


int match_pattern_list(const char *string, const char *pattern,
    size_t len, int dolower) {
  char sub[1024];
  int negated;
  int got_positive;
  size_t i, subi;

  got_positive = 0;
  for (i = 0; i < len;) {

    if (pattern[i] == '!') {
      negated = 1;
      i++;
    } else {
      negated = 0;
    }

    for (subi = 0;
        i < len && subi < sizeof(sub) - 1 && pattern[i] != ',';
        subi++, i++) {
      sub[subi] = dolower && isupper(pattern[i]) ?
        (char)tolower(pattern[i]) : pattern[i];
    }

    if (subi >= sizeof(sub) - 1) {
      return 0;
    }

    if (i < len && pattern[i] == ',') {
      i++;
    }

    sub[subi] = '\0';

    if (match_pattern(string, sub, MAX_MATCH_RECURSION)) {
      if (negated) {
        return -1;
      } else {
        got_positive = 1;
      }
    }
  }

  return got_positive;
}

Input: {'string': '0x1261f30 "1"', 'pattern': '0x12622c0 "**"', 'len': '2', 'dolower': '1'}

Output: {'type': 'int', 'value': '1'}


static int match_pattern(const char *s, const char *pattern, size_t limit)
{
    bool had_asterisk = false;

    if (s == NULL || pattern == NULL || limit <= 0) {
        return 0;
    }

    for (;;) {

        if (*pattern == '\0') {
            return (*s == '\0');
        }

        while (*pattern == '*' || (had_asterisk && *pattern == '?')) {
            if (*pattern == '*') {
                had_asterisk = true;
            }
            pattern++;
        }

        if (had_asterisk) {

            if (!*pattern)
                return 1;

            if (*pattern != '?') {

                for (; *s; s++)
                    if (*s == *pattern && match_pattern(s + 1, pattern + 1, limit - 1)) {
                        return 1;
                    }

                return 0;
            }

            for (; *s; s++) {
                if (match_pattern(s, pattern, limit - 1)) {
                    return 1;
                }
            }

            return 0;
        }

        if (!*s) {
            return 0;
        }

        if (*pattern != '?' && *pattern != *s) {
            return 0;
        }

        s++;
        pattern++;
    }

    return 0;
}

Input: {'s': '0x12637b0 ""', 'pattern': '0x7fffffffb2b3 "1"', 'limit': '16'}

Output: {'type': 'int', 'value': '1'}


int ssh_buffer_allocate_size(struct ssh_buffer_struct *buffer,
                             uint32_t len)
{
    buffer_verify(buffer);

    if (buffer->allocated < len) {
        if (buffer->pos > 0) {
            buffer_shift(buffer);
        }
        if (realloc_buffer(buffer, len) < 0) {
            return -1;
        }
    }

    buffer_verify(buffer);

    return 0;
}

Input: {'buffer': '{secure: 80, used: 32767, allocated: 5008526, pos: 0, data: 0x1262d99 ""}', 'len': '0'}

Output: {'type': 'int', 'value': '0'}


static int _base64_to_bin(unsigned char dest[3], const char *source, int num) {
  unsigned long block;

  if (to_block4(&block, source, num) < 0) {
    return -1;
  }
  dest[0] = GET_A(block);
  dest[1] = GET_B(block);
  dest[2] = GET_C(block);

  return 0;
}

Input: {'dest[3]': 'NULL', 'source': '0x12ada40 "A-eDI1\\327"', 'num': '0'}

Output: {'type': 'int', 'value': '-1'}


uint32_t ssh_buffer_get_data(struct ssh_buffer_struct *buffer, void *data, uint32_t len)
{
    int rc;

    rc = ssh_buffer_validate_length(buffer, len);
    if (rc != SSH_OK) {
        return 0;
    }
    memcpy(data,buffer->data+buffer->pos,len);
    buffer->pos+=len;
    return len;
}

Input: {'buffer': '{secure: false, used: 0, allocated: 2, pos: 3, data: 0x300000001 <error: Cannot access memory at address 0x300000001>}', 'data': 'NULL', 'len': '32767'}

Output: {'type': 'int', 'value': '-1'}


int ssh_buffer_unpack_va(struct ssh_buffer_struct *buffer,
                         const char *format,
                         size_t argc,
                         va_list ap)
{
    int rc = SSH_ERROR;
    const char *p = format, *last;
    union {
        uint8_t *byte;
        uint16_t *word;
        uint32_t *dword;
        uint64_t *qword;
        ssh_string *string;
        char **cstring;
        bignum *bignum;
        void **data;
    } o;
    size_t len;
    uint32_t rlen, max_len;
    ssh_string tmp_string = NULL;
    va_list ap_copy;
    size_t count;

    max_len = ssh_buffer_get_len(buffer);

    va_copy(ap_copy, ap);

    if (argc > 256) {
        rc = SSH_ERROR;
        goto cleanup;
    }

    for (count = 0; *p != '\0'; p++, count++) {

        if (count > argc) {
            rc = SSH_ERROR;
            goto cleanup;
        }

        rc = SSH_ERROR;
        switch (*p) {
        case 'b':
            o.byte = va_arg(ap, uint8_t *);
            rlen = ssh_buffer_get_u8(buffer, o.byte);
            rc = rlen==1 ? SSH_OK : SSH_ERROR;
            break;
        case 'w':
            o.word = va_arg(ap,  uint16_t *);
            rlen = ssh_buffer_get_data(buffer, o.word, sizeof(uint16_t));
            if (rlen == 2) {
                *o.word = ntohs(*o.word);
                rc = SSH_OK;
            }
            break;
        case 'd':
            o.dword = va_arg(ap, uint32_t *);
            rlen = ssh_buffer_get_u32(buffer, o.dword);
            if (rlen == 4) {
                *o.dword = ntohl(*o.dword);
                rc = SSH_OK;
            }
            break;
        case 'q':
            o.qword = va_arg(ap, uint64_t*);
            rlen = ssh_buffer_get_u64(buffer, o.qword);
            if (rlen == 8) {
                *o.qword = ntohll(*o.qword);
                rc = SSH_OK;
            }
            break;
        case 'B':
            o.bignum = va_arg(ap, bignum *);
            *o.bignum = NULL;
            tmp_string = ssh_buffer_get_ssh_string(buffer);
            if (tmp_string == NULL) {
                break;
            }
            *o.bignum = ssh_make_string_bn(tmp_string);
            ssh_string_burn(tmp_string);
            SSH_STRING_FREE(tmp_string);
            rc = (*o.bignum != NULL) ? SSH_OK : SSH_ERROR;
            break;
        case 'S':
            o.string = va_arg(ap, ssh_string *);
            *o.string = ssh_buffer_get_ssh_string(buffer);
            rc = *o.string != NULL ? SSH_OK : SSH_ERROR;
            o.string = NULL;
            break;
        case 's': {
            uint32_t u32len = 0;

            o.cstring = va_arg(ap, char **);
            *o.cstring = NULL;
            rlen = ssh_buffer_get_u32(buffer, &u32len);
            if (rlen != 4){
                break;
            }
            len = ntohl(u32len);
            if (len > max_len - 1) {
                break;
            }

            rc = ssh_buffer_validate_length(buffer, len);
            if (rc != SSH_OK) {
                break;
            }

            *o.cstring = malloc(len + 1);
            if (*o.cstring == NULL){
                rc = SSH_ERROR;
                break;
            }
            rlen = ssh_buffer_get_data(buffer, *o.cstring, len);
            if (rlen != len){
                SAFE_FREE(*o.cstring);
                rc = SSH_ERROR;
                break;
            }
            (*o.cstring)[len] = '\0';
            o.cstring = NULL;
            rc = SSH_OK;
            break;
        }
        case 'P':
            len = va_arg(ap, size_t);
            if (len > max_len - 1) {
                rc = SSH_ERROR;
                break;
            }

            rc = ssh_buffer_validate_length(buffer, len);
            if (rc != SSH_OK) {
                break;
            }

            o.data = va_arg(ap, void **);
            count++;

            *o.data = malloc(len);
            if(*o.data == NULL){
                rc = SSH_ERROR;
                break;
            }
            rlen = ssh_buffer_get_data(buffer, *o.data, len);
            if (rlen != len){
                SAFE_FREE(*o.data);
                rc = SSH_ERROR;
                break;
            }
            o.data = NULL;
            rc = SSH_OK;
            break;
        default:
            SSH_LOG(SSH_LOG_TRACE, "Invalid buffer format %c", *p);
        }
        if (rc != SSH_OK) {
            break;
        }
    }

    if (argc != count) {
        rc = SSH_ERROR;
    }

cleanup:
    if (rc != SSH_ERROR){

        uint32_t canary = va_arg(ap, uint32_t);
        if (canary != SSH_BUFFER_PACK_END){
            abort();
        }
    }

    if (rc != SSH_OK){

        last = p;
        for(p=format;p<last;++p){
            switch(*p){
            case 'b':
                o.byte = va_arg(ap_copy, uint8_t *);
                if (buffer->secure) {
                    explicit_bzero(o.byte, sizeof(uint8_t));
                    break;
                }
                break;
            case 'w':
                o.word = va_arg(ap_copy, uint16_t *);
                if (buffer->secure) {
                    explicit_bzero(o.word, sizeof(uint16_t));
                    break;
                }
                break;
            case 'd':
                o.dword = va_arg(ap_copy, uint32_t *);
                if (buffer->secure) {
                    explicit_bzero(o.dword, sizeof(uint32_t));
                    break;
                }
                break;
            case 'q':
                o.qword = va_arg(ap_copy, uint64_t *);
                if (buffer->secure) {
                    explicit_bzero(o.qword, sizeof(uint64_t));
                    break;
                }
                break;
            case 'B':
                o.bignum = va_arg(ap_copy, bignum *);
                bignum_safe_free(*o.bignum);
                break;
            case 'S':
                o.string = va_arg(ap_copy, ssh_string *);
                if (buffer->secure) {
                    ssh_string_burn(*o.string);
                }
                SAFE_FREE(*o.string);
                break;
            case 's':
                o.cstring = va_arg(ap_copy, char **);
                if (buffer->secure) {
                    explicit_bzero(*o.cstring, strlen(*o.cstring));
                }
                SAFE_FREE(*o.cstring);
                break;
            case 'P':
                len = va_arg(ap_copy, size_t);
                o.data = va_arg(ap_copy, void **);
                if (buffer->secure) {
                    explicit_bzero(*o.data, len);
                }
                SAFE_FREE(*o.data);
                break;
            default:
                (void)va_arg(ap_copy, void *);
                break;
            }
        }
    }
    va_end(ap_copy);

    return rc;
}

Input: {'buffer': '{secure: 48, used: 0, allocated: 4294956720, pos: 32767, data: 0x7fffffffd640 "\\004"}', 'format': '0x7531a4 "get_name"', 'argc': '7591798', 'ap': 'error'}

Output: {'type': 'unsigned int', 'value': '2'}


int _ssh_buffer_unpack(struct ssh_buffer_struct *buffer,
                       const char *format,
                       size_t argc,
                       ...)
{
    va_list ap;
    int rc;

    va_start(ap, argc);
    rc = ssh_buffer_unpack_va(buffer, format, argc, ap);
    va_end(ap);
    return rc;
}

Input: {'buffer': '{secure: 72, used: 317227848, allocated: 36669199, pos: 2336751616, data: 0x25fd750d8d48e845 <error: Cannot access memory at address 0x25fd750d8d48e845>}', 'format': '0x7fffffffd6b0 "\\220\\327\\377\\377\\377\\177"', 'argc': '140737488344752', '...': 'NULL'}

Output: {'type': 'int', 'value': '-1'}


bool ssh_key_size_allowed_rsa(int min_size, ssh_key key)
{
    int key_size = ssh_key_size(key);

    if (min_size < 768) {
        if (ssh_fips_mode()) {
            min_size = 2048;
        } else {
            min_size = 1024;
        }
    }
    return (key_size >= min_size);
}

Input: {'min_size': '2', 'key': '0x125c450'}

Output: {'type': 'int', 'value': '2048'}


int ssh_socket_write(ssh_socket s, const void *buffer, uint32_t len)
{
    if (len > 0) {
        if (ssh_buffer_add_data(s->out_buffer, buffer, len) < 0) {
            ssh_set_error_oom(s->session);
            return SSH_ERROR;
        }
        ssh_socket_nonblocking_flush(s);
    }

    return SSH_OK;
}

Input: {'s': 'NULL', 'buffer': 'NULL', 'len': '0'}

Output: {'type': 'int', 'value': '0'}


int ssh_send_banner(ssh_session session, int server)
{
    const char *banner = CLIENT_BANNER_SSH2;
    const char *terminator = "\r\n";

    char buffer[256] = {0};
    size_t len;
    int rc = SSH_ERROR;

    if (server == 1) {
        if (session->opts.custombanner == NULL){
            session->serverbanner = strdup(banner);
            if (session->serverbanner == NULL) {
                goto end;
            }
        } else {
            len = strlen(session->opts.custombanner);
            session->serverbanner = malloc(len + 8 + 1);
            if(session->serverbanner == NULL) {
                goto end;
            }
            snprintf(session->serverbanner,
                     len + 8 + 1,
                     "SSH-2.0-%s",
                     session->opts.custombanner);
        }

        snprintf(buffer,
                 sizeof(buffer),
                 "%s%s",
                 session->serverbanner,
                 terminator);
    } else {
        session->clientbanner = strdup(banner);
        if (session->clientbanner == NULL) {
            goto end;
        }

        snprintf(buffer,
                 sizeof(buffer),
                 "%s%s",
                 session->clientbanner,
                 terminator);
    }

    rc = ssh_socket_write(session->socket, buffer, strlen(buffer));
    if (rc == SSH_ERROR) {
        goto end;
    }
#ifdef WITH_PCAP
    if (session->pcap_ctx != NULL) {
        ssh_pcap_context_write(session->pcap_ctx,
                               SSH_PCAP_DIR_OUT,
                               buffer,
                               strlen(buffer),
                               strlen(buffer));
    }
#endif

    rc = SSH_OK;
end:
    return rc;
}

Input: {'session': '0x125cf40', 'server': '0'}

Output: {'type': 'int', 'value': '0'}


int ssh_handle_packets_termination(ssh_session session,
                                   int timeout,
                                   ssh_termination_function fct,
                                   void *user)
{
    struct ssh_timestamp ts;
    int timeout_ms = SSH_TIMEOUT_INFINITE;
    int tm;
    int ret = SSH_OK;

    if (timeout >= 0) {
        timeout_ms = timeout;
    } else {
        if (ssh_is_blocking(session)) {
            if (timeout == SSH_TIMEOUT_USER || timeout == SSH_TIMEOUT_DEFAULT) {
                if (session->opts.timeout > 0 ||
                    session->opts.timeout_usec > 0) {
                    timeout_ms =
                        ssh_make_milliseconds(session->opts.timeout,
                                              session->opts.timeout_usec);
                }
            }
        } else {
            timeout_ms = SSH_TIMEOUT_NONBLOCKING;
        }
    }

    if (timeout_ms != SSH_TIMEOUT_NONBLOCKING) {
        ssh_timestamp_init(&ts);
    }

    tm = timeout_ms;
    while(!fct(user)) {
        ret = ssh_handle_packets(session, tm);
        if (ret == SSH_ERROR) {
            break;
        }
        if (ssh_timeout_elapsed(&ts, timeout_ms)) {
            ret = fct(user) ? SSH_OK : SSH_AGAIN;
            break;
        }

        tm = ssh_timeout_update(&ts, timeout_ms);
    }

    return ret;
}

Input: {'session': 'NULL', 'timeout': '0', 'fct': 'NULL', 'user': 'NULL'}

{'timeout': {'type': 'int', 'value': '0'}}

Output: {'type': 'int', 'value': '1'}


int ssh_socket_pollcallback(struct ssh_poll_handle_struct *p,
                            socket_t fd,
                            int revents,
                            void *v_s)
{
    ssh_socket s = (ssh_socket)v_s;
    void *buffer = NULL;
    ssize_t nread = 0;
    int rc;
    int err = 0;
    socklen_t errlen = sizeof(err);

    if (!ssh_socket_is_open(s)) {
        return -1;
    }
    SSH_LOG(SSH_LOG_TRACE,
            "Poll callback on socket %d (%s%s%s), out buffer %" PRIu32, fd,
            (revents & POLLIN) ? "POLLIN ":"",
            (revents & POLLOUT) ? "POLLOUT ":"",
            (revents & POLLERR) ? "POLLERR":"",
            ssh_buffer_get_len(s->out_buffer));
    if ((revents & POLLERR) || (revents & POLLHUP)) {

        if (s->state == SSH_SOCKET_CONNECTING) {
            s->state = SSH_SOCKET_ERROR;
            rc = getsockopt(fd, SOL_SOCKET, SO_ERROR, (char *)&err, &errlen);
            if (rc < 0) {
                err = errno;
            }
            ssh_socket_close(s);

            s->last_errno = err;
            errno = err;

            if (s->callbacks != NULL && s->callbacks->connected != NULL) {
                s->callbacks->connected(SSH_SOCKET_CONNECTED_ERROR,
                                        err,
                                        s->callbacks->userdata);
            }

            return -1;
        }

        revents |= POLLIN;
    }
    if ((revents & POLLIN) && s->state == SSH_SOCKET_CONNECTED) {
        s->read_wontblock = 1;
        buffer = ssh_buffer_allocate(s->in_buffer, MAX_BUF_SIZE);
        if (buffer) {
            nread = ssh_socket_unbuffered_read(s, buffer, MAX_BUF_SIZE);
        }
        if (nread < 0) {
            ssh_buffer_pass_bytes_end(s->in_buffer, MAX_BUF_SIZE);
            if (p != NULL) {
                ssh_poll_remove_events(p, POLLIN);
            }

            if (s->callbacks != NULL && s->callbacks->exception != NULL) {
                s->callbacks->exception(SSH_SOCKET_EXCEPTION_ERROR,
                                        s->last_errno,
                                        s->callbacks->userdata);
            }
            return -2;
        }

        ssh_buffer_pass_bytes_end(s->in_buffer, MAX_BUF_SIZE - nread);

        if (nread == 0) {
            if (p != NULL) {
                ssh_poll_remove_events(p, POLLIN);
            }
            if (s->callbacks != NULL && s->callbacks->exception != NULL) {
                s->callbacks->exception(SSH_SOCKET_EXCEPTION_EOF,
                                        0,
                                        s->callbacks->userdata);
            }
            return -2;
        }

        if (s->session->socket_counter != NULL) {
            s->session->socket_counter->in_bytes += nread;
        }

        if (s->callbacks != NULL && s->callbacks->data != NULL) {
            size_t processed;
            do {
                processed = s->callbacks->data(ssh_buffer_get(s->in_buffer),
                                               ssh_buffer_get_len(s->in_buffer),
                                               s->callbacks->userdata);
                ssh_buffer_pass_bytes(s->in_buffer, processed);
            } while ((processed > 0) && (s->state == SSH_SOCKET_CONNECTED));

            p = NULL;
        }
    }
#ifdef _WIN32
    if (revents & POLLOUT || revents & POLLWRNORM) {
#else
    if (revents & POLLOUT) {
#endif
        uint32_t len;

        if (s->state == SSH_SOCKET_CONNECTING) {
            SSH_LOG(SSH_LOG_PACKET, "Received POLLOUT in connecting state");
            ssh_socket_set_connected(s, p);

            rc = ssh_socket_set_blocking(ssh_socket_get_fd(s));
            if (rc < 0) {
                return -1;
            }

            if (s->callbacks != NULL && s->callbacks->connected != NULL) {
                s->callbacks->connected(SSH_SOCKET_CONNECTED_OK,
                                        0,
                                        s->callbacks->userdata);
            }

            return 0;
        }

        s->write_wontblock = 1;
        if (p != NULL) {
            ssh_poll_remove_events(p, POLLOUT);
        }

        len = ssh_buffer_get_len(s->out_buffer);
        if (len > 0) {
            ssh_socket_nonblocking_flush(s);
        } else if (s->callbacks != NULL && s->callbacks->controlflow != NULL) {

            SSH_LOG(SSH_LOG_TRACE, "sending control flow event");
            s->callbacks->controlflow(SSH_SOCKET_FLOW_WRITEWONTBLOCK,
                                      s->callbacks->userdata);
        }

    }

    if (s->poll_handle == NULL) {
        return -1;
    }

    return 0;
}

Input: {'p': '{ctx: 0x7fffffffdc30, session: 0x50f3a0 <ssh_poll_ctx_dopoll+1216>, x: {fd: 16, idx: 16}, events: -19072, lock_cnt: 0, cb: 0x500000003, cb_data: VOID}', 'fd': '-1', 'revents': '-9192', 'v_s': 'NULL'}

Output: {'type': 'int', 'value': '1'}


static int ssh_buffer_pack_allocate_va(struct ssh_buffer_struct *buffer,
                                       const char *format,
                                       size_t argc,
                                       va_list ap)
{
    const char *p = NULL;
    ssh_string string = NULL;
    char *cstring = NULL;
    size_t needed_size = 0;
    size_t len;
    size_t count;
    int rc = SSH_OK;

    for (p = format, count = 0; *p != '\0'; p++, count++) {

        if (count > argc) {
            return SSH_ERROR;
        }

        switch(*p) {
        case 'b':
            va_arg(ap, unsigned int);
            needed_size += sizeof(uint8_t);
            break;
        case 'w':
            va_arg(ap, unsigned int);
            needed_size += sizeof(uint16_t);
            break;
        case 'd':
            va_arg(ap, uint32_t);
            needed_size += sizeof(uint32_t);
            break;
        case 'q':
            va_arg(ap, uint64_t);
            needed_size += sizeof(uint64_t);
            break;
        case 'S':
            string = va_arg(ap, ssh_string);
            needed_size += 4 + ssh_string_len(string);
            string = NULL;
            break;
        case 's':
            cstring = va_arg(ap, char *);
            needed_size += sizeof(uint32_t) + strlen(cstring);
            cstring = NULL;
            break;
        case 'P':
            len = va_arg(ap, size_t);
            needed_size += len;
            va_arg(ap, void *);
            count++;
            break;
        case 'B':
            va_arg(ap, bignum);

            needed_size += 64;
            break;
        case 't':
            cstring = va_arg(ap, char *);
            needed_size += strlen(cstring);
            cstring = NULL;
            break;
        default:
            SSH_LOG(SSH_LOG_TRACE, "Invalid buffer format %c", *p);
            rc = SSH_ERROR;
        }
        if (rc != SSH_OK){
            break;
        }
    }

    if (argc != count) {
        return SSH_ERROR;
    }

    if (rc != SSH_ERROR){

        uint32_t canary = va_arg(ap, uint32_t);
        if (canary != SSH_BUFFER_PACK_END) {
            abort();
        }
    }

    rc = ssh_buffer_allocate_size(buffer, (uint32_t)needed_size);
    if (rc != 0) {
        return SSH_ERROR;
    }

    return SSH_OK;
}

Input: {'buffer': '{secure: 65, used: 1852406393, allocated: 1633820775, pos: 1919250030, data: 0x65704f007325203a <error: Cannot access memory at address 0x65704f007325203a>}', 'format': '0x300000000 <error: Cannot access memory at address 0x300000000>', 'argc': '19312896', 'ap': '{gp_offset: 4276653451, fp_offset: 2240544767, overflow_arg_area: VOID, reg_save_area: VOID}'}

Output: {'type': 'int', 'value': '0'}


int _ssh_buffer_pack(struct ssh_buffer_struct *buffer,
                     const char *format,
                     size_t argc,
                     ...)
{
    va_list ap;
    int rc;

    if (argc > 256) {
        return SSH_ERROR;
    }

    va_start(ap, argc);
    rc = ssh_buffer_pack_allocate_va(buffer, format, argc, ap);
    va_end(ap);

    if (rc != SSH_OK) {
        return rc;
    }

    va_start(ap, argc);
    rc = ssh_buffer_pack_va(buffer, format, argc, ap);
    va_end(ap);

    return rc;
}

Input: {'buffer': '{secure: 115, used: 1684956531, allocated: 2019912543, pos: 1852134144, data: 0x58454b20676e6964 <error: Cannot access memory at address 0x58454b20676e6964>}', 'format': '0x72f03d "Sending KEXINIT packet, first_kex_packet_follows = %d"', 'argc': '15', '...': 'NULL'}

Output: {'type': 'int', 'value': '0'}


int ssh_buffer_add_u8(struct ssh_buffer_struct *buffer,uint8_t data)
{
    int rc;

    rc = ssh_buffer_add_data(buffer, &data, sizeof(uint8_t));
    if (rc < 0) {
        return -1;
    }

    return 0;
}

Input: {'buffer': '{secure: 139, used: 3359231045, allocated: 1278479, pos: 92930048, data: 0x5880104002eb713 <error: Cannot access memory at address 0x5880104002eb713>}', 'data': "0 '\\000'"}

Output: {'type': 'int', 'value': '0'}


int ssh_buffer_pack_va(struct ssh_buffer_struct *buffer,
                       const char *format,
                       size_t argc,
                       va_list ap)
{
    int rc = SSH_ERROR;
    const char *p;
    union {
        uint8_t byte;
        uint16_t word;
        uint32_t dword;
        uint64_t qword;
        ssh_string string;
        void *data;
    } o;
    char *cstring;
    bignum b;
    size_t len;
    size_t count;

    if (argc > 256) {
        return SSH_ERROR;
    }

    for (p = format, count = 0; *p != '\0'; p++, count++) {

        if (count > argc) {
            return SSH_ERROR;
        }

        switch(*p) {
        case 'b':
            o.byte = (uint8_t)va_arg(ap, unsigned int);
            rc = ssh_buffer_add_u8(buffer, o.byte);
            break;
        case 'w':
            o.word = (uint16_t)va_arg(ap, unsigned int);
            o.word = htons(o.word);
            rc = ssh_buffer_add_u16(buffer, o.word);
            break;
        case 'd':
            o.dword = va_arg(ap, uint32_t);
            o.dword = htonl(o.dword);
            rc = ssh_buffer_add_u32(buffer, o.dword);
            break;
        case 'q':
            o.qword = va_arg(ap, uint64_t);
            o.qword = htonll(o.qword);
            rc = ssh_buffer_add_u64(buffer, o.qword);
            break;
        case 'S':
            o.string = va_arg(ap, ssh_string);
            rc = ssh_buffer_add_ssh_string(buffer, o.string);
            o.string = NULL;
            break;
        case 's':
            cstring = va_arg(ap, char *);
            len = strlen(cstring);
            rc = ssh_buffer_add_u32(buffer, htonl(len));
            if (rc == SSH_OK){
                rc = ssh_buffer_add_data(buffer, cstring, len);
            }
            cstring = NULL;
            break;
        case 'P':
            len = va_arg(ap, size_t);

            o.data = va_arg(ap, void *);
            count++;

            rc = ssh_buffer_add_data(buffer, o.data, len);
            o.data = NULL;
            break;
        case 'B':
            b = va_arg(ap, bignum);
            o.string = ssh_make_bignum_string(b);
            if(o.string == NULL){
                rc = SSH_ERROR;
                break;
            }
            rc = ssh_buffer_add_ssh_string(buffer, o.string);
            SAFE_FREE(o.string);
            break;
        case 't':
            cstring = va_arg(ap, char *);
            len = strlen(cstring);
            rc = ssh_buffer_add_data(buffer, cstring, len);
            cstring = NULL;
            break;
        default:
            SSH_LOG(SSH_LOG_TRACE, "Invalid buffer format %c", *p);
            rc = SSH_ERROR;
        }
        if (rc != SSH_OK){
            break;
        }
    }

    if (argc != count) {
        return SSH_ERROR;
    }

    if (rc != SSH_ERROR){

        uint32_t canary = va_arg(ap, uint32_t);
        if (canary != SSH_BUFFER_PACK_END) {
            abort();
        }
    }
    return rc;
}

Input: {'buffer': '{secure: false, used: 0, allocated: 64, pos: 0, data: 0x127a230 "\\260\\244\'\\001"}', 'format': '0x72f073 "bP"', 'argc': '3', 'ap': '{gp_offset: 24, fp_offset: 48, overflow_arg_area: VOID, reg_save_area: VOID}'}

Output: {'type': 'int', 'value': '0'}


int ssh_buffer_add_data(struct ssh_buffer_struct *buffer, const void *data, uint32_t len)
{
    if (buffer == NULL) {
        return -1;
    }

    buffer_verify(buffer);

    if (data == NULL) {
        return -1;
    }

    if (buffer->used + len < len) {
        return -1;
    }

    if (buffer->allocated < (buffer->used + len)) {
        if (buffer->pos > 0) {
            buffer_shift(buffer);
        }
        if (realloc_buffer(buffer, buffer->used + len) < 0) {
            return -1;
        }
    }

    memcpy(buffer->data + buffer->used, data, len);
    buffer->used += len;
    buffer_verify(buffer);
    return 0;
}

Input: {'buffer': '{secure: false, used: 4294958240, allocated: 32767, pos: 4294958240, data: 0x4d009000007fff <error: Cannot access memory at address 0x4d009000007fff>}', 'data': 'NULL', 'len': '0'}

Output: {'type': 'int', 'value': '0'}


int ssh_packet_send_unimplemented(ssh_session session, uint32_t seqnum){
    int rc;

    rc = ssh_buffer_pack(session->out_buffer,
                         "bd",
                         SSH2_MSG_UNIMPLEMENTED,
                         seqnum);
    if (rc != SSH_OK) {
        ssh_set_error_oom(session);
        return SSH_ERROR;
    }
    rc = ssh_packet_send(session);

    return rc;
}

Input: {'session': '0x127b290', 'seqnum': '1'}

Output: {'type': 'int', 'value': '0'}


int ssh_buffer_add_u32(struct ssh_buffer_struct *buffer,uint32_t data)
{
    int rc;

    rc = ssh_buffer_add_data(buffer, &data, sizeof(data));
    if (rc < 0) {
        return -1;
    }

    return 0;
}

Input: {'buffer': '{secure: false, used: 1, allocated: 64, pos: 0, data: 0x13045a0 "\\001E0\\001"}', 'data': '0'}

Output: {'type': 'int', 'value': '0'}