[erlang-bugs] R12B01 erl_misc_utils.c stack-trashing bug, + a patch

Mikael Pettersson <>
Wed Jul 29 13:22:35 CEST 2009


Michael Turner writes:
 > 
 > 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))

Two nits:
1. Subject doesn't match contents (different Erlang versions).
2. The patch is broken due to line-wrapping in three lines. When sending
   patches, you must ensure that the text isn't mangled in any way.
   (Many MUAs appear to be broken in this regard.)


More information about the erlang-bugs mailing list