Missing patch in R13B02-1 for fixing build time segmentation fault

Akira Kitada akitada@REDACTED
Thu Sep 24 10:39:50 CEST 2009


Hi,

I'm resubmitting Michael Turner's patch which seemingly missed in
R13B02(-1) release.
The original report is below.
I confirmed this patch fixes the build issue in R13B02-1.

Please consider including this in the next release.

Thanks,
Akira

---------- Forwarded message ----------
From: Michael Turner <leap@REDACTED>
Date: Wed, Jul 29, 2009 at 5:34 PM
Subject: [erlang-bugs] R12B01 erl_misc_utils.c stack-trashing bug, + a patch
To: erlang-bugs@REDACTED



Was trying to build on a i386_unknown_freebsd4.10, with a gcc about 10
years old.  The build died in /lib/parsetools/src.  gdb revealed
revealed a trashed stack.

The source of the problem became clear after narrowing it down to a
function in erl_misc_utils.c.  There are assignments to mib[0] and
mib[1], with mib declared size zero. (Yes.  sizeof (mib) == 0.  The
first time I've ever seen that.  And the last, I hope.)

Dimension of 2 for mib[] seemed appropriate in context.  The build
continued after that fix.

==========

--- otp_src_R13B01/erts/lib_src/common/erl_misc_utils.c.~1~     Wed Jul 29
00:53:30 2009
+++ otp_src_R13B01/erts/lib_src/common/erl_misc_utils.c Tue Jul 28
22:17:45 2009
@@ -172,7 +172,7 @@ erts_cpu_info_update(erts_cpu_info_t *cp
 #elif defined(HAVE_SYS_SYSCTL_H) && defined(CTL_HW) && (defined(HW_NCPU)
\
                                                       || defined(HW_AVAILCPU))
    {
-       int mib[0];
+       int mib[2];
       size_t len;

#ifdef HW_NCPU


________________________________________________________________
erlang-bugs mailing list. See http://www.erlang.org/faq.html
erlang-bugs (at) erlang.org


More information about the erlang-patches mailing list