Created
February 23, 2016 07:15
-
-
Save ojii/9eba9cc492b5b47810a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void segfault() | |
{ | |
*(int*)0=0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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