Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 809056 - =x11-base/xwayland-21.1.2-r2 - ../xwayland-21.1.2/render/picture.c:874:26: error: array subscript ‘union _SourcePict[0]’ is partly outside array bounds of ‘unsigned char[16]’ [-Werror=array-bounds]
Summary: =x11-base/xwayland-21.1.2-r2 - ../xwayland-21.1.2/render/picture.c:874:26: er...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo X packagers
URL: https://gitlab.freedesktop.org/xorg/x...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-19 11:53 UTC by Seong-ho Cho
Modified: 2022-08-23 01:56 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log of x11-base/xwayland-21.1.2-r2 (build.log,416.46 KB, text/x-log)
2021-08-19 11:53 UTC, Seong-ho Cho
Details
emerge --info (emerge_info.log,10.09 KB, text/x-log)
2021-08-19 11:54 UTC, Seong-ho Cho
Details
patch for blocking build of xwayland-21.1.2-r2 (xwayland-werror-array-bounds.patch,440 bytes, patch)
2021-08-19 11:55 UTC, Seong-ho Cho
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Seong-ho Cho 2021-08-19 11:53:57 UTC
Created attachment 734200 [details]
build.log of x11-base/xwayland-21.1.2-r2

I have an experience compilation failed of x11-base/xwayland as below,
This error looks similar to #467088 (This is xorg-server's bug).

[230/419] x86_64-pc-linux-gnu-gcc -Irender/liblibxserver_render.a.p -Irender -I../xwayland-21.1.2/render -IXext -I../xwayland-21.1.2/Xext -IXi -I../xwayland-21.1.2/Xi -Icomposite -I../xwayland-21.1.2/composite -Idamageext -I../xwayland-21.1.2/damageext -Ifb -I../xwayland-21.1.2/fb -Iglamor -I../xwayland-21.1.2/glamor -Imi -I../xwayland-21.1.2/mi -Imiext/damage -I../xwayland-21.1.2/miext/damage -Imiext/sync -I../xwayland-21.1.2/miext/sync -Idbe -I../xwayland-21.1.2/dbe -Idri3 -I../xwayland-21.1.2/dri3 -Iinclude -I../xwayland-21.1.2/include -Ipresent -I../xwayland-21.1.2/present -Irandr -I../xwayland-21.1.2/randr -Ixfixes -I../xwayland-21.1.2/xfixes -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-4 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -DHAVE_DIX_CONFIG_H -fno-strict-aliasing -fvisibility=hidden -Wall -Wpointer-arith -Wmissing-declarations -Wformat=2 -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wbad-function-cast -Wold-style-definition -Wunused -Wuninitialized -Wshadow -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Werror=implicit -Werror=nonnull -Werror=init-self -Werror=main -Werror=missing-braces -Werror=sequence-point -Werror=return-type -Werror=trigraphs -Werror=array-bounds -Werror=write-strings -Werror=address -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -march=corei7 -O2 -pipe -msse4.1 -msse4.2 -mtune=generic -fPIC -pthread -D_DEFAULT_SOURCE -D_BSD_SOURCE -DHAS_FCHOWN -DHAS_STICKY_DIR_BIT -MD -MQ render/liblibxserver_render.a.p/picture.c.o -MF render/liblibxserver_render.a.p/picture.c.o.d -o render/liblibxserver_render.a.p/picture.c.o -c ../xwayland-21.1.2/render/picture.c
FAILED: render/liblibxserver_render.a.p/picture.c.o 
x86_64-pc-linux-gnu-gcc -Irender/liblibxserver_render.a.p -Irender -I../xwayland-21.1.2/render -IXext -I../xwayland-21.1.2/Xext -IXi -I../xwayland-21.1.2/Xi -Icomposite -I../xwayland-21.1.2/composite -Idamageext -I../xwayland-21.1.2/damageext -Ifb -I../xwayland-21.1.2/fb -Iglamor -I../xwayland-21.1.2/glamor -Imi -I../xwayland-21.1.2/mi -Imiext/damage -I../xwayland-21.1.2/miext/damage -Imiext/sync -I../xwayland-21.1.2/miext/sync -Idbe -I../xwayland-21.1.2/dbe -Idri3 -I../xwayland-21.1.2/dri3 -Iinclude -I../xwayland-21.1.2/include -Ipresent -I../xwayland-21.1.2/present -Irandr -I../xwayland-21.1.2/randr -Ixfixes -I../xwayland-21.1.2/xfixes -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-4 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -DHAVE_DIX_CONFIG_H -fno-strict-aliasing -fvisibility=hidden -Wall -Wpointer-arith -Wmissing-declarations -Wformat=2 -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wbad-function-cast -Wold-style-definition -Wunused -Wuninitialized -Wshadow -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Werror=implicit -Werror=nonnull -Werror=init-self -Werror=main -Werror=missing-braces -Werror=sequence-point -Werror=return-type -Werror=trigraphs -Werror=array-bounds -Werror=write-strings -Werror=address -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -march=corei7 -O2 -pipe -msse4.1 -msse4.2 -mtune=generic -fPIC -pthread -D_DEFAULT_SOURCE -D_BSD_SOURCE -DHAS_FCHOWN -DHAS_STICKY_DIR_BIT -MD -MQ render/liblibxserver_render.a.p/picture.c.o -MF render/liblibxserver_render.a.p/picture.c.o.d -o render/liblibxserver_render.a.p/picture.c.o -c ../xwayland-21.1.2/render/picture.c
../xwayland-21.1.2/render/picture.c: In function ‘CreateSolidPicture’:
../xwayland-21.1.2/render/picture.c:874:26: error: array subscript ‘union _SourcePict[0]’ is partly outside array bounds of ‘unsigned char[16]’ [-Werror=array-bounds]
  874 |     pPicture->pSourcePict->type = SourcePictTypeSolidFill;
      |                          ^~
../xwayland-21.1.2/render/picture.c:868:45: note: object of size 16 allocated by ‘malloc’
  868 |     pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictSolidFill));
      |                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../xwayland-21.1.2/render/picture.c: In function ‘CreateLinearGradientPicture’:
../xwayland-21.1.2/render/picture.c:906:26: error: array subscript ‘union _SourcePict[0]’ is partly outside array bounds of ‘unsigned char[32]’ [-Werror=array-bounds]
  906 |     pPicture->pSourcePict->linear.type = SourcePictTypeLinear;
      |                          ^~
../xwayland-21.1.2/render/picture.c:899:45: note: object of size 32 allocated by ‘malloc’
  899 |     pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictLinearGradient));
      |                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../xwayland-21.1.2/render/picture.c: In function ‘CreateConicalGradientPicture’:
../xwayland-21.1.2/render/picture.c:989:26: error: array subscript ‘union _SourcePict[0]’ is partly outside array bounds of ‘unsigned char[32]’ [-Werror=array-bounds]
  989 |     pPicture->pSourcePict->conical.type = SourcePictTypeConical;
      |                          ^~
../xwayland-21.1.2/render/picture.c:982:45: note: object of size 32 allocated by ‘malloc’
  982 |     pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictConicalGradient));
      |                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

1) above error log is attached as build.log in this report,
2) emerge --info log is also attached as emerge_info.log

and I would like to suggest patch to address this problem as below,
I am not sure whether this solution is optimal or not.

3) xwayland-werror-array-bounds.patch

Thank you in advance for reviewing my bug report and patch.
Comment 1 Seong-ho Cho 2021-08-19 11:54:46 UTC
Created attachment 734203 [details]
emerge --info
Comment 2 Seong-ho Cho 2021-08-19 11:55:32 UTC
Created attachment 734206 [details, diff]
patch for blocking build of xwayland-21.1.2-r2
Comment 3 Matt Turner gentoo-dev 2021-10-22 04:00:26 UTC
> CFLAGS="-march=corei7 ... -mtune=generic"

Just a heads up: I don't think this makes any sense. You're asking GCC to use instructions that only corei7 has but then to tune the code for a generic CPU. I suspect you got those reversed.
Comment 4 Matt Turner gentoo-dev 2021-11-18 06:49:18 UTC
Might be https://gitlab.freedesktop.org/xorg/xserver/-/issues/1256
Comment 5 Matt Turner gentoo-dev 2022-08-23 01:56:42 UTC
Looks fixed in current releases.