Author: tridge Date: 2006-09-14 16:08:13 +0000 (Thu, 14 Sep 2006) New Revision: 18528
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18528 Log: work around what appears to be a compiler bug in gcc on irix. It caused the RPC-SECRETS test to crash smbd in an inlined version of this memcmp() call. This patch should have absolutely no effect at all, but in fact it prevents the crash. Disassembling at the point of the crash, it shows that gcc is inlining the memcmp(). I don't know enough MIPS assembler to actually spot the bug. In case anyone reading this does know MIPS assembler, here is the gcc generated code that crashes: 0x105e0218 <gssapi_krb5_verify_header+168>: lw $t1,52($sp) 0x105e021c <gssapi_krb5_verify_header+172>: lw $t1,0($t1) 0x105e0220 <gssapi_krb5_verify_header+176>: lhu $t1,0($t1) 0x105e0224 <gssapi_krb5_verify_header+180>: lw $t2,68($sp) 0x105e0228 <gssapi_krb5_verify_header+184>: lhu $t2,0($t2) 0x105e022c <gssapi_krb5_verify_header+188>: subu $t1,$t1,$t2 it gets a segv at 0x105e0220. lha, what do you think of this? The change should be innocuous on all other platforms, apart from making the code harder to read :( Modified: branches/SAMBA_4_0/source/heimdal/lib/gssapi/decapsulate.c Changeset: Modified: branches/SAMBA_4_0/source/heimdal/lib/gssapi/decapsulate.c =================================================================== --- branches/SAMBA_4_0/source/heimdal/lib/gssapi/decapsulate.c 2006-09-14 16:02:58 UTC (rev 18527) +++ branches/SAMBA_4_0/source/heimdal/lib/gssapi/decapsulate.c 2006-09-14 16:08:13 UTC (rev 18528) @@ -110,7 +110,7 @@ if (len < 2) return GSS_S_DEFECTIVE_TOKEN; - if (memcmp (*str, type, 2) != 0) + if ((*str)[0] != type[0] || (*str)[1] != type[1]) return GSS_S_DEFECTIVE_TOKEN; *str += 2;