[LLVMbugs] [Bug 9684] llvm-gcc and clang both miscompile nedit-5.5/source/regularExp.c at -O2

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jun 10 10:09:32 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=9684

Benjamin Kramer <benny.kra at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |benny.kra at gmail.com
         Resolution|                            |INVALID

--- Comment #5 from Benjamin Kramer <benny.kra at gmail.com> 2011-06-10 12:09:31 CDT ---
This is a bug in nedit. It boils down to:

===
#include <string.h>
#include <limits.h>

static unsigned char Default_Delimiters[UCHAR_MAX] = {0};

int main() {
  memset(Default_Delimiters, 0, 256);
}
===

The memset will overrun Default_Delimiters by one byte. OS X enables checking
of memset bounds, in this case it only sees the size of Default_Delimiters
through inlining at -O2 though.

You can either patch nedit or compile with -D_FORTIFY_SOURCE=0, which disables
memset checking.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list