To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=50592 Issue #:|50592 Summary:|gcc4, glibc-2.6, -D_FORTIFY_SOURCE=2, and memmove Component:|porting Version:|680m108 Platform:|PC URL:| OS/Version:|Linux Status:|NEW Status whiteboard:| Keywords:| Resolution:| Issue type:|PATCH Priority:|P3 Subcomponent:|code Assigned to:|mh Reported by:|pmladek
------- Additional comments from [EMAIL PROTECTED] Fri Jun 10 10:56:44 -0700 2005 ------- gcc4 together with the latest versions of glibc provides a new feature. It allows to check some buffer overflows in functions like memcpy, memmove, ... at compile time. The feature is enabled by -D_FORTIFY_SOURCE=2 in CFLAGS. If the feature is enabled, the affected functions are redefined, such as memcpy is redefined in /usr/include/bits/string3.h: --- cut --- #define memmove(dest, src, len) \ ((__bos0 (dest) != (size_t) -1) \ ? __builtin___memmove_chk (dest, src, len, __bos0 (dest)) \ : __memmove_ichk (dest, src, len)) --- cut --- OOo provides its own implementation of memmove in: soltools/cpp/_unix.c idlc/source/preproc/unix.c It is still possible, but the macro memmove must be undefined before the function declaration or definition. The fixed implementaiton could look like: /* memmove is defined here because some vendors don't provide it at all and others do a terrible job (like calling malloc) */ #if !defined(__IBMC__) && !defined(_WIN32) #undef memmove void * memmove(void *dp, const void *sp, size_t n) { unsigned char *cdp, *csp; [...] A better solution is to disable the redefinition when glibc is used. glibc includes correct implementation. The fixed implementation could look like: /* memmove is defined here because some vendors don't provide it at all and others do a terrible job (like calling malloc) */ #if !defined(__IBMC__) && !defined(_WIN32) && !defined(__GLIBC__) void * memmove(void *dp, const void *sp, size_t n) { unsigned char *cdp, *csp; [...] I'll attach a patch for the second case. --------------------------------------------------------------------- Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]