Skip to content

Instantly share code, notes, and snippets.

@ojii
Created February 23, 2016 07:15
Show Gist options
  • Save ojii/9eba9cc492b5b47810a7 to your computer and use it in GitHub Desktop.
Save ojii/9eba9cc492b5b47810a7 to your computer and use it in GitHub Desktop.
void segfault()
{
*(int*)0=0;
}
from cffi import FFI
def ffi_compile():
ffi = FFI()
with open('segfault.c') as fobj:
ffi.set_source("_segfault", fobj.read())
ffi.cdef("void segfault();")
ffi.compile()
if __name__ == '__main__':
ffi_compile()
else:
from _segfault import lib
segfault = lib.segfault
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment