Summary:ASTERISK-12318: res_config_ldap crashes consistently with "Illegal Instruction"
Reporter:W. Michael Petullo (flyn)Labels:
Date Opened:2008-07-04 14:50:26Date Closed:2008-07-14 16:54:36
Versions:Frequency of
Description:The problem appeared after we fixed bug ASTERISK-11960.

The res_config_ldap.so module consistently crashes with an illegal instruction on the statement "if (strncasecmp("{md5}", valptr, 5) == 0)" I have looked at this quite a bit, and have not yet been able to determine what is causing this.

I've looked at this with both gdb and valgrind and can't figure out the problem.

I have done some experimenting as documented below. The very odd behavior seems to indicate there may be some type of memory corruption happening elsewhere.


If I replace "if (strncasecmp..." with "if (1)" then the crash goes away.

If I replace "if (strncasecmp..." with "if (valptr[0] == '{' && valptr[0] == 'M'..." then the crash goes away.

If I add a "printf("foo\n");" to the realtime_ldap_result_to_vars function between:

if (strncasecmp(valptr, "{md5}", 5) == 0) {


valptr += 5;

then the "illegal instruction" error goes away and the realtime LDAP driver works.
Comments:By: Tilghman Lesher (tilghman) 2008-07-05 10:00:51

Please report this upstream to the GCC project.  As you correctly attested, there is nothing wrong with the code, but your version of GCC is generating invalid code.

By: Tilghman Lesher (tilghman) 2008-07-14 16:54:36

Closing.  Not a bug in Asterisk.