I have a c++ program that links a static c library. The library wraps some ldap functions. Running the program it crashes in one of my wrapper functions on a SLES 15. (The crash did not occure on Windows Server).
Running the program in valgrind everything is fine.
Running it with gdb or examining the coredump it is strange. It seems that the function ldap_get_values
returns a 32 bit pointer:
(gdb) p entry
$1 = (LDAPMessage *) 0x7fffdc004b90
(gdb) p values
$2 = (char **) 0xffffffffdc0053e0
(gdb) p *values
Cannot access memory at address 0xffffffffdc0053e0
(gdb) p *(char**)0x7fffdc0053e0
$3 = 0x7fffdc0053c0 "20240506095057"
I have checked the static library. All included object files are ELF 64-bit LSB relocatable
.
I have no clue what causes the problem. What can I check? Are there compiler or linker options to check?
The issue could be related to 64 bit function returns 32 bit pointer but the function declarations should be complete cause ldap.h
is included.