General hint:
seg-faults in malloc(), free(), realloc() etc. are usually caused by earlier
corruption of the heap.  Looking at the stack at the time of crash is
rarely successful.

A better hint is to link to a special debug variant of malloc(), which is
specifically designed to report the exact point when a bug is corrupting
the heap.  On UNIX/Linux/BSD etc. there are several such libraries and
I am not sure which one to recommend.  On Windows, the best choice
for heap corruption cases is usually the "Page Heap" in Windows itself,
controlled on a per process basis with the "Global Flags" facility.

On 22-01-2012 20:22, Prashant Batra wrote:
Hi,

I am observing a seg-fault with following back-trace-


#0  0x089277fe in _int_malloc ()
#1  0x08926a72 in malloc ()
#2  0x087df811 in default_malloc_ex (num=4, file=0x89eda40 "bn_lib.c",
line=336) at mem.c:79
#3  0x087dfe30 in CRYPTO_malloc (num=4, file=0x89eda40 "bn_lib.c",
line=336) at mem.c:304
#4  0x087e729d in bn_expand_internal (b=0xa1c0bc8, words=1) at bn_lib.c:336
#5  0x087e74c2 in bn_expand2 (b=0xa1c0bc8, words=1) at bn_lib.c:451
#6  0x087e7885 in BN_set_word (a=0xa1c0bc8, w=1) at bn_lib.c:589
#7  0x087ea037 in DH_check_pub_key (dh=0x8be1688, pub_key=0x982de00,
ret=0xbfdcebd8) at dh_check.c:130
#8  0x087e965e in compute_key (key=0xbfdcec38 "", pub_key=0x982de00,
dh=0x8be1688) at dh_key.c:212
#9  0x087e9204 in DH_compute_key (key=0xbfdcec38 "",
pub_key=0x982de00, dh=0x8be1688) at dh_key.c:81

DH_compute_key is called with following values-
(gdb) p *pub_key
$28 = {d = 0x982dff8, top = 32, dmax = 32, neg = 0, flags = 1}
(gdb) p *dh
$29 = {pad = 0, version = 0, p = 0x8bdfea0, g = 0x8bdaac0, length = 0,
pub_key = 0x8bdfeb8, priv_key = 0x8bd9c40, flags = 1, method_mont_p =
0x8be0898, q = 0x0, j = 0x0, seed = 0x0, seedlen = 0,
   counter = 0x0, references = 1, ex_data = {sk = 0x0, dummy =
146792592}, meth = 0x8a26240, engine = 0x0}

Can somebody help me debugging this issue as I am new to the openssl code.

Any help will be appreciated.

Regards,
Prashant
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to