Skip to content

Instantly share code, notes, and snippets.

@rhizoome
Last active December 9, 2017 18:29
Show Gist options
  • Save rhizoome/4b9bbfc68806681e2c82138bbe653fee to your computer and use it in GitHub Desktop.
Save rhizoome/4b9bbfc68806681e2c82138bbe653fee to your computer and use it in GitHub Desktop.
Fuzzing my C networking library with valgrind memcheck and hypothesis takes long, but finds bugs.
Leaked allocations:
0x4f199e0 0x4f19ab0
/outside/src/util.c:141: Assert failed: There is a memory leak
==5859==
==5859== HEAP SUMMARY:
==5859== in use at exit: 3,719 bytes in 11 blocks
==5859== total heap usage: 3,628 allocs, 3,621 frees, 345,682 bytes allocated
==5859==
==5859== 1,200 bytes in 1 blocks are indirectly lost in loss record 8 of 9
==5859== at 0x4C929C5: malloc (vg_replace_malloc.c:299)
==5859== by 0x122469: ch_alloc (util.c:227)
==5859== by 0x127F2C: ch_bf_init (buffer.c:84)
==5859== by 0x123E9D: ch_rd_init (reader.c:572)
==5859== by 0x11CA98: ch_cn_init (connection.c:474)
==5859== by 0x1251BC: ch_pr_conn_start (protocol.c:387)
==5859== by 0x124DA4: _ch_pr_new_connection_cb (protocol.c:260)
==5859== by 0x52AF3B6: uv__server_io (in /usr/lib/libuv.so.1.0.0)
==5859== by 0x52B305B: uv__io_poll (in /usr/lib/libuv.so.1.0.0)
==5859== by 0x52A719A: uv_run (in /usr/lib/libuv.so.1.0.0)
==5859== by 0x1204F1: ch_run (chirp.c:1046)
==5859== by 0x11FE9A: ch_chirp_run (chirp.c:858)
.......
-------------- Hypothesis -------------------
Step #1: ('init_etest', '0')
Step #2: ('42', 0)
Step #3: ('send_message', (<AddressFamily.AF_INET: 2>, 2997))
Step #4: ('fuzz_main_port',
(b'\x0b\xb5\xbcdf\x08\x04\xe4ZD\x8fk\xe4.z~\x0f;',
[b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00']))
================================= 1 failed, 1 passed in 3062.42 seconds =====================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment