Hello community,

here is the log from the commit of package libX11 for openSUSE:Factory checked 
in at 2018-03-16 10:34:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libX11 (Old)
 and      /work/SRC/openSUSE:Factory/.libX11.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libX11"

Fri Mar 16 10:34:34 2018 rev:22 rq:587472 version:1.6.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/libX11/libX11.changes    2017-03-05 
17:56:00.547712694 +0100
+++ /work/SRC/openSUSE:Factory/.libX11.new/libX11.changes       2018-03-16 
10:34:35.643387810 +0100
@@ -1,0 +2,6 @@
+Thu Mar 15 09:01:19 UTC 2018 - [email protected]
+
+- u_Use-flexible-array-member-instead-of-fake-size.patch
+  * Fixes build error with gcc8. (bnc#1084639)
+
+-------------------------------------------------------------------

New:
----
  u_Use-flexible-array-member-instead-of-fake-size.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libX11.spec ++++++
--- /var/tmp/diff_new_pack.EXbxLg/_old  2018-03-16 10:34:37.239330347 +0100
+++ /var/tmp/diff_new_pack.EXbxLg/_new  2018-03-16 10:34:37.243330203 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package libX11
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -34,6 +34,8 @@
 Patch9:         p_xlib_skip_ext_env.diff
 # PATCH-FIX-UPSTREAM en-locales.diff fdo#48596 bnc#388711 -- Add missing data 
for more en locales
 Patch15:        en-locales.diff
+# PATCH-FIX-UPSTREAM u_Use-flexible-array-member-instead-of-fake-size.patch -- 
Fix build error with gcc8.
+Patch16:        u_Use-flexible-array-member-instead-of-fake-size.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  autoconf >= 2.60
@@ -142,6 +144,7 @@
 %patch7 -p0
 %patch9 -p0
 %patch15 -p0
+%patch16 -p1
 
 %build
 # Got patches which change auto*files

++++++ u_Use-flexible-array-member-instead-of-fake-size.patch ++++++
Author: Michal Srb <[email protected]>
Subject: Use flexible array member instead of fake size.
Patch-mainline: To be upstreamed
References: bnc#1084639

The _XimCacheStruct structure is followed in memory by two strings containing
fname and encoding. The memory was accessed using the last member of the
structure `char fname[1]`. That is a lie, prohibits us from using sizeof and
confuses checkers. Lets declare it properly as a flexible array, so compilers
don't complain about writing past that array. As bonus we can replace the
XOffsetOf with regular sizeof.

Fixes GCC8 error:
  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));

Caused by this line seemingly writing past the fname[1] array:
  imLcIm.c:479:  strcpy (m->fname+strlen(name)+1, encoding);
---
 modules/im/ximcp/imLcIm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/im/ximcp/imLcIm.c b/modules/im/ximcp/imLcIm.c
index c19695df..743df77b 100644
--- a/modules/im/ximcp/imLcIm.c
+++ b/modules/im/ximcp/imLcIm.c
@@ -82,8 +82,8 @@ struct _XimCacheStruct {
     DTCharIndex     mbused;
     DTCharIndex     wcused;
     DTCharIndex     utf8used;
-    char            fname[1];
-    /* char encoding[1] */
+    char            fname[];
+    /* char encoding[] */
 };
 
 static struct  _XimCacheStruct* _XimCache_mmap = NULL;
@@ -281,7 +281,7 @@ _XimReadCachedDefaultTree(
     assert (m->id == XIM_CACHE_MAGIC);
     assert (m->version == XIM_CACHE_VERSION);
     if (size != m->size ||
-       size < XOffsetOf (struct _XimCacheStruct, fname) + namelen + 
encodinglen) {
+       size < sizeof (struct _XimCacheStruct) + namelen + encodinglen) {
        fprintf (stderr, "Ignoring broken XimCache %s [%s]\n", name, encoding);
         munmap (m, size);
         return False;
@@ -442,7 +442,7 @@ _XimWriteCachedDefaultTree(
     int   fd;
     FILE *fp;
     struct _XimCacheStruct *m;
-    int   msize = (XOffsetOf(struct _XimCacheStruct, fname)
+    int   msize = (sizeof(struct _XimCacheStruct)
                   + strlen(name) + strlen(encoding) + 2
                   + XIM_CACHE_TREE_ALIGNMENT-1) & -XIM_CACHE_TREE_ALIGNMENT;
     DefTreeBase *b = &im->private.local.base;
-- 
2.13.6


Reply via email to