Segmentation Fault in ncrypt.dh.fromPEM_Parameters

Bug #925381 reported by Veselin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ncrypt (Ubuntu)
New
Undecided
Unassigned

Bug Description

We need CSpace (http://cspace.in) to be able to work on 64bit Linux machines.
However it fails sometimes with Segmentation Fault, but only on 64bit machines.

After long searching I found the problem in the file sslcontext.py.
Here is a part of it which cause SegFault:

#EXAMPLE BEGIN

from ncrypt.dh import DH

_dh_params_pem = """
-----BEGIN DH PARAMETERS-----
MIGHAoGBAPSI/VhOSdvNILSd5JEHNmszbDgNRR0PfIizHHxbLY7288kjwEPwpVsY
jY67VYy4XTjTNP18F1dDox0YbN4zISy1Kv884bEpQBgRjXyEpwpy1obEAxnIByl6
ypUM2Zafq9AKUJsCRtMIPWakXUGfnHy9iUsiGSa6q6Jew1XpL3jHAgEC
-----END DH PARAMETERS-----
copied from openssl-0.9.8b/apps/dh1024.pem
"""

dh = DH()
dh.fromPEM_Parameters( _dh_params_pem )

#EXAMPLE END

My system is Dell:

veselin@dell64:~$ uname -a
Linux dell64 2.6.38-13-generic #54-Ubuntu SMP Tue Jan 3 13:38:12 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

veselin@dell64:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 11.04
Release: 11.04
Codename: natty

Revision history for this message
Veselin (datahaven) wrote :

Even this code fails:

from ncrypt.rsa import RSAKey

keysrc = """
-----BEGIN RSA PUBLIC KEY-----
MIIBCAKCAQEA7GlbcsySk8cgHfzx7BmGnF+WWrwFRpMJN26u9BsAL0eETEeQsQXE
gDeKrUHMs5EKtBBRuJlHKy0uxqK0M/KyAfBw7a6HhNQwT2/2dXhylUre1coCHeIv
KBkV1WJxNnjCJwKrWY0y5geKczPnRoAYJFqNZE1XzyYOqYmVoCs6XB5yPw2nOfcV
TX5fXYPzsnA9EaR+l2GKbmwIJXGZTW4kl1P6VCjrtlEL5B1qyOd3JYUm8JRJihca
8LIQrNu00awnxAkUQS0ucp5MHaI0jFK79sgkDujdAWtPL7A/CK97WUMNl9JhAvV/
oN9GFZO5MuNwUcfu1Nqf8Xj18lT1g9bH5wIBBQ==
-----END RSA PUBLIC KEY-----
"""

k = RSAKey()
k.fromPEM_PublicKey( keysrc )

Revision history for this message
Veselin (datahaven) wrote :
Download full text (13.3 KiB)

I was looking inside and build ncrypt-0.6.4 from sources.
In the code (inside fromPEM_PublicKey) I put marker and found that this function was finished successfully.
But SegFault - still happens.

Here is a full backtrace:

veselin@dell64:~$ gdb python
GNU gdb (Ubuntu/Linaro 7.2-1ubuntu11) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/python...Reading symbols from /usr/lib/debug/usr/bin/python2.7...done.
done.
(gdb) run testncrypt.py
Starting program: /usr/bin/python testncrypt.py
[Thread debugging using libthread_db enabled]
1
2
3
4
5
6
7
8

Program received signal SIGSEGV, Segmentation fault.
PyEval_EvalFrameEx (f=<value optimized out>, throwflag=<value optimized out>) at ../Python/ceval.c:1067
1067 ../Python/ceval.c: Нет такого файла или каталога.
 in ../Python/ceval.c
(gdb) bt
#0 PyEval_EvalFrameEx (f=<value optimized out>, throwflag=<value optimized out>) at ../Python/ceval.c:1067
#1 0x000000000049d325 in PyEval_EvalCodeEx (co=0x9b48b0, globals=<value optimized out>, locals=<value optimized out>,
    args=<value optimized out>, argcount=<value optimized out>, kws=<value optimized out>, kwcount=0, defs=0x0, defcount=0, closure=0x0)
    at ../Python/ceval.c:3253
#2 0x00000000004ecb02 in PyEval_EvalCode (co=<value optimized out>, globals=<value optimized out>, locals=<value optimized out>)
    at ../Python/ceval.c:667
#3 0x00000000004fdc74 in run_mod (mod=<value optimized out>, filename=<value optimized out>, globals=
    {'keysrc': '\n-----BEGIN RSA PUBLIC KEY-----\nMIIBCAKCAQEA7GlbcsySk8cgHfzx7BmGnF+WWrwFRpMJN26u9BsAL0eETEeQsQXE\ngDeKrUHMs5EKtBBRuJlHKy0uxqK0M/KyAfBw7a6HhNQwT2/2dXhylUre1coCHeIv\nKBkV1WJxNnjCJwKrWY0y5geKczPnRoAYJFqNZE1XzyYOqYmVoCs6XB5yPw2nOfcV\nTX5fXYPzsnA9EaR+l2GKbmwIJXGZTW4kl1P6VCjrtlEL5B1qyOd3JYUm8JRJihca\n8LIQrNu00awnxAkUQS0ucp5MHaI0jFK79sgkDujdAWtPL7A/CK97WUMNl9JhAvV/\noN9GFZO5MuNwUcfu1Nqf8Xj18lT1g9bH5wIBBQ==\n-----END RSA PUBLIC KEY-----\n', '__builtins__': <module at remote 0x7ffff7f95ad0>, '__file__': 'testncrypt.py', 'RSAKey': <type at remote 0x7ffff61f3900>, '__package__': None, '__name__': '__main__', '__doc__': None, 'k': <ncrypt_rsa.RSAKey at remote 0x8e9430>}, locals=
    {'keysrc': '\n-----BEGIN RSA PUBLIC KEY-----\nMIIBCAKCAQEA7GlbcsySk8cgHfzx7BmGnF+WWrwFRpMJN26u9BsAL0eETEeQsQXE\ngDeKrUHMs5EKtBBRuJlHKy0uxqK0M/KyAfBw7a6HhNQwT2/2dXhylUre1coCHeIv\nKBkV1WJxNnjCJwKrWY0y5geKczPnRoAYJFqNZE1XzyYOqYmVoCs6XB5yPw2nOfcV\nTX5fXYPzsnA9EaR+l2GKbmwIJXGZTW4kl1P6VCjrtlEL5B1qyOd3JYUm8JRJihca\n8LIQrNu00awnxAkUQS0ucp5MHaI0jFK79sgkDujdAWtPL7A/CK97WUMNl9JhAvV/\noN9GFZO5MuNwUcfu1Nqf8Xj18lT1g9bH5wIBBQ==\n-----END RSA PUBLIC KEY-----\n', '__builtins__': <module at remote 0x7ffff7f95ad0>, '__file__': 'testncrypt.py', 'RSAKey': <type at remote 0x7ffff61f3900>, '__package__': None, '__name__': '__main__', '__doc_...

Revision history for this message
Veselin (datahaven) wrote :

It fails on this machine too:

veselinux@datahaven:~$ uname -a
Linux datahaven.net 2.6.32.9-rscloud #6 SMP Thu Mar 11 14:32:05 UTC 2010 x86_64 GNU/Linux

The python is 2.6.5.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.