keybase / saltpack-python

A Python implementation of saltpack, mainly for testing. Only partial support for V2.
102 stars 15 forks source link

Dumps core #1

Closed kseistrup closed 8 years ago

kseistrup commented 8 years ago

I'm aware that this is not the proper way to use saltpack, but it shouldn't dump core:

$ python3
Python 3.5.1 (default, Dec  7 2015, 12:58:09) 
[GCC 5.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from saltpack.encrypt import encrypt
>>> encrypt(None, None, 'test', 32)
Segmentation fault (core dumped)

Saltpack doesn't seem to have a __version__ string, but it's the current version from PyPI.

Stack trace of thread 5279: 
#0  0x00007f7553715e18 n/a (libsodium.so) 
#1  0x00007f7553d261f0 ffi_call_unix64 (libffi.so.6) 
#2  0x00007f7553d25c58 ffi_call (libffi.so.6) 
#3  0x00007f7553f3949f _ctypes_callproc (_ctypes.cpython-35m-x86_64-linux-gnu.so) 
#4  0x00007f7553f33699 n/a (_ctypes.cpython-35m-x86_64-linux-gnu.so) 
#5  0x00007f7557e224ca PyObject_Call (libpython3.5m.so.1.0) 
#6  0x00007f7557edb8cc PyEval_EvalFrameEx (libpython3.5m.so.1.0) 
#7  0x00007f7557ee1d52 PyEval_EvalFrameEx (libpython3.5m.so.1.0) 
#8  0x00007f7557ee1d52 PyEval_EvalFrameEx (libpython3.5m.so.1.0) 
#9  0x00007f7557ee2df2 n/a (libpython3.5m.so.1.0) 
#10 0x00007f7557ee2ed3 PyEval_EvalCodeEx (libpython3.5m.so.1.0) 
#11 0x00007f7557ee2efb PyEval_EvalCode (libpython3.5m.so.1.0) 
#12 0x00007f7557f02074 n/a (libpython3.5m.so.1.0) 
#13 0x00007f7557f040e2 PyRun_InteractiveOneObject (libpython3.5m.so.1.0) 
#14 0x00007f7557f0439e PyRun_InteractiveLoopFlags (libpython3.5m.so.1.0) 
#15 0x00007f7557f04b2e PyRun_AnyFileExFlags (libpython3.5m.so.1.0) 
#16 0x00007f7557f1b368 Py_Main (libpython3.5m.so.1.0) 
#17 0x0000000000400af7 main (python3.5) 
#18 0x00007f7557819610 __libc_start_main (libc.so.6) 
#19 0x0000000000400b99 _start (python3.5)
oconnor663 commented 8 years ago

Just added __version__, thanks for pointing that out.

The segfault is probably happening in libnacl. It might make more sense to switch back to pynacl than to try to fix it. (I used pynacl originally, and then switched to libnacl for some lower-level bindings, but now I don't think I need those bindings anymore.)

oconnor663 commented 8 years ago

Yep, there it is:

$ python
Python 3.5.1 (default, Dec  7 2015, 12:58:09) 
[GCC 5.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import libnacl
>>> libnacl.crypto_scalarmult_base(None)
Segmentation fault (core dumped)
oconnor663 commented 8 years ago

About to land https://github.com/keybase/saltpack-python/tree/pynacl, just want to play with it a little more.

oconnor663 commented 8 years ago

Landed and released as v0.1.1. Thanks again for the report.

kseistrup commented 8 years ago

Thanks!