[Bug 1084639] GCC 8: libX11 build fails
http://bugzilla.suse.com/show_bug.cgi?id=1084639 http://bugzilla.suse.com/show_bug.cgi?id=1084639#c1 Michal Srb <msrb@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |CONFIRMED CC| |msrb@suse.com --- Comment #1 from Michal Srb <msrb@suse.com> --- Confirmed. The full error is:
In file included from /usr/include/string.h:494, from /usr/include/X11/Xos.h:62, from imLcIm.c:42: In function 'strcpy', inlined from '_XimWriteCachedDefaultTree' at imLcIm.c:479:5, inlined from '_XimCreateDefaultTree' at imLcIm.c:616:2, inlined from '_XimLocalOpenIM' at imLcIm.c:700:5: /usr/include/bits/string_fortified.h:90:10: error: '__builtin_strcpy' forming offset 2 is out of the bounds [0, 1] [-Werror=array-bounds] return __builtin___strcpy_chk (__dest, __src, __bos (__dest));
The offending line is:
imLcIm.c:479: strcpy (m->fname+strlen(name)+1, encoding);
The `m` is `struct _XimCacheStruct*` and the `fname` field is `char fname[1]`. So gcc is complaining that we are going to write past this 1-element array. The allocated memory for `m` is actually big enough to store the full fname plus encoding behind the `_XimCacheStruct` struct, so it works. No idea why the original author decided that `char fname[1]` is a good way to declare it. I'll change it to something that doesn't trigger the warning. -- You are receiving this mail because: You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com