Hi



If I add a print statement as shown in red color below in file
'crypto/asn1/x_name.c' the opensll does not give segment violation. The
printf statement anywhere else in the source code does not avoid segment
violation.



It does not make sense to me. I can only guess that there may be some stack
corruption going on from the calls above the print statement.





Source code:



static int x509_name_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long
len, const ASN1_ITEM *it,

int tag, int aclass, char opt, ASN1_TLC *ctx)

{

const unsigned char *p = *in, *q;

STACK *intname = NULL, **intname_pp = &intname;

int i, j, ret;

X509_NAME *nm = NULL, **nm_pp = &nm;

STACK_OF(X509_NAME_ENTRY) *entries;

X509_NAME_ENTRY *entry;

q = p;



/* Get internal representation of Name */

ret = ASN1_item_ex_d2i((ASN1_VALUE **)intname_pp,

&p, len, ASN1_ITEM_rptr(X509_NAME_INTERNAL),

tag, aclass, opt, ctx);



if(ret <= 0) return ret;



if(*val) x509_name_ex_free(val, NULL);

if(!x509_name_ex_new((ASN1_VALUE **)nm_pp, NULL)) goto err;

/* We've decoded it: now cache encoding */

printf("i am here second p-q %d\n", p - q); fflush(stdout);

if(!BUF_MEM_grow(nm->bytes, p - q)) goto err;

memcpy(nm->bytes->data, q, p - q);



/* Convert internal representation to X509_NAME structure */

for(i = 0; i < sk_num(intname); i++) {

entries = (STACK_OF(X509_NAME_ENTRY) *)sk_value(intname, i);

for(j = 0; j < sk_X509_NAME_ENTRY_num(entries); j++) {

entry = sk_X509_NAME_ENTRY_value(entries, j);

entry->set = i;

if(!sk_X509_NAME_ENTRY_push(nm->entries, entry))

goto err;

}

sk_X509_NAME_ENTRY_free(entries);

}



-----Original Message-----
From: postmaster@Merkur.SBone.TU-Cottbus.De
[mailtoostmaster@Merkur.SBone.TU-Cottbus.De] On Behalf Of Stephen Henson
via RT
Sent: Thursday, March 23, 2006 1:10 PM
To: sam.sharma@gat.com
Cc: openssl-dev@openssl.org
Subject: [openssl.org #1296] openssl 0.9.8a/0.9.7g crashes on IA64



[sam.sharma@gat.com - Thu Mar 23 18:53:13 2006]:



> Hi


>


> I wrote the public key information as binary data into a file named


> buffer.der. Unfortunately the command as shown also gives the segment


> violation for ssl 0.9.8a version. The same openssl command from 0.9.7d


works

> fine. Let me know I can do more tests to help find out the fix.


>


> /home/srbkit/srbpkg/ssl/64.8a/install/bin/openssl x509 -inform DER -in


> buffer.der


>


> The gdb output looks like below (I will compile ssl in debug mode and send


> you more information if necessary). Also I will try to compare the 0.9.7d


> and 0.9.8a code and see I can get to any where.


>




Yes please compile with debugging symbols. Its is impossible to see what

line it is crashing on or the function arguments without them.



Can you also mail me the binary data you passed to that command?

__________________________________________________ ____________________
OpenSSL Project http://www.openssl.org
Development Mailing List openssl-dev@openssl.org
Automated List Manager majordomo@openssl.org