Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash on improper use #7

Open
alevesely opened this issue May 27, 2017 · 0 comments
Open

crash on improper use #7

alevesely opened this issue May 27, 2017 · 0 comments

Comments

@alevesely
Copy link

I agree with EAFP,[*] but crashing breaks Python semantics, so this improper use should be guarded. I'm not clear if this bug is in libarchive.so or in python-libarchive. Unless libarchive.so (possibly implicitly) states arguments validity as a precondition, the bug is theirs. However, I only report it here, for now.

Python 2.7.9 (default, Jun 29 2016, 13:08:31) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libarchive.public
>>> with libarchive.public.memory_reader(open('v2.zip').read()) as e:
...  pass
... 
>>> next(e)

Program received signal SIGSEGV, Segmentation fault.
0x0000000000b0eca0 in ?? ()
(gdb) bt
#0  0x0000000000b0eca0 in ?? ()
#1  0x00007ffff6403dc0 in ffi_call_unix64 () from /usr/lib/x86_64-linux-gnu/libffi.so.6
#2  0x00007ffff6403828 in ffi_call () from /usr/lib/x86_64-linux-gnu/libffi.so.6
#3  0x00007ffff665f055 in _call_function_pointer (argcount=2, resmem=0x7fffffffd110, restype=<optimized out>, atypes=<optimized out>, avalues=0x7fffffffd0f0, pProc=0x7ffff580b590 <archive_read_next_header>, flags=4353) at /home/jmm/scratch/spu/python2.7-2.7.9/Modules/_ctypes/callproc.c:836
#4  _ctypes_callproc (pProc=pProc@entry=0x7ffff580b590 <archive_read_next_header>, argtuple=argtuple@entry=0x7ffff63ba3b0, flags=4353, argtypes=argtypes@entry=0x7ffff6398518, restype=restype@entry=0xa67480, checker=checker@entry=0x0) at /home/jmm/scratch/spu/python2.7-2.7.9/Modules/_ctypes/callproc.c:1179
#5  0x00007ffff66639b2 in PyCFuncPtr_call.lto_priv.95 (self=<optimized out>, inargs=<optimized out>, kwds=<optimized out>) at /home/jmm/scratch/spu/python2.7-2.7.9/Modules/_ctypes/_ctypes.c:3965

[*] "It is Easier to Ask for Forgiveness than Permission"
https://en.wikipedia.org/wiki/Python_syntax_and_semantics#Exceptions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant