[Date Prev][Date Next] [Chronological] [Thread] [Top]

slapd segfaults on LP64 system (ITS#2663)



Full_Name: Masato Taruishi
Version: HEAD
OS: Linux (Opteron)
URL: 
Submission from: (NULL) (210.128.90.14)


I just tried to compile and test OpenLDAP on Linux AMD-64 (Opteron), but
slapd exits with SIGSEGV. This is because ucstr.c uses ber_memalloc_x but 
no prototypes is defined within this source context. Therefore, compiler assumes
its return type of ber_memalloc_x is int.

On LP64 systems such as Linux on Itanium, Alpha, Opteron, pointer
size is 64 bit but int size is 32 bit. Then the above assuming removes most
significant 32bits when casting to pointer. The attached patch fixes this
problem. Though I don't check this other than opteron, it should work on other
LP64 systems.

I just compiled ldbm only and make test was success.

Thanks

Index: libraries/liblunicode/ucstr.c
===================================================================
RCS file: /repo/OpenLDAP/pkg/ldap/libraries/liblunicode/ucstr.c,v
retrieving revision 1.29
diff -u -r1.29 ucstr.c
--- libraries/liblunicode/ucstr.c       7 Jul 2003 03:50:20 -0000       1.29
+++ libraries/liblunicode/ucstr.c       24 Jul 2003 08:51:34 -0000
@@ -19,6 +19,9 @@
 #define        realloc(x,y)    ber_memrealloc_x(x,y,ctx)
 #define        free(x)         ber_memfree_x(x,ctx)
  
+/* include ber_memalloc_x family prototypes */
+#include "../libraries/libldap/ldap-int.h"
+
 int ucstrncmp(
        const ldap_unicode_t *u1,
        const ldap_unicode_t *u2,