diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2024-05-27 18:59:53 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2024-08-07 09:58:01 -0500 |
commit | 7d400b67ac3b7e17ee4af583b6e5f01a5c9690a1 (patch) | |
tree | 379b35003a8caa0760033f9890648eb3b441d62e /user | |
parent | a59d56d506d362cbb6de7d7a850223167488878c (diff) | |
download | packages-7d400b67ac3b7e17ee4af583b6e5f01a5c9690a1.tar.gz packages-7d400b67ac3b7e17ee4af583b6e5f01a5c9690a1.tar.bz2 packages-7d400b67ac3b7e17ee4af583b6e5f01a5c9690a1.tar.xz packages-7d400b67ac3b7e17ee4af583b6e5f01a5c9690a1.zip |
user/xorg-server: Update for GCC 12+ compat
Diffstat (limited to 'user')
-rw-r--r-- | user/xorg-server/APKBUILD | 8 | ||||
-rw-r--r-- | user/xorg-server/gcc12.patch | 89 | ||||
-rw-r--r-- | user/xorg-server/rgb-mask.patch | 70 |
3 files changed, 165 insertions, 2 deletions
diff --git a/user/xorg-server/APKBUILD b/user/xorg-server/APKBUILD index 0bca19339..17909c830 100644 --- a/user/xorg-server/APKBUILD +++ b/user/xorg-server/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: A. Wilcox <awilfox@adelielinux.org> pkgname=xorg-server pkgver=1.20.9 -pkgrel=0 +pkgrel=1 pkgdesc="X.Org X11 server" url="https://www.X.Org/" arch="all" @@ -26,6 +26,8 @@ subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc xvfb $pkgname-xephyr source="https://www.X.Org/releases/individual/xserver/$pkgname-$pkgver.tar.bz2 autoconfig-sis.patch fix-musl-arm.patch + rgb-mask.patch + gcc12.patch " # secfixes: @@ -142,4 +144,6 @@ xwayland() { sha512sums="d9b5f93e1b9763a89187d8b272aa7d4ce9709641b8539f4536708af153310e5a4931bffd4229c51a3b0e3b12da7838750aa71b635751fb4c0bb27438cce4e5e6 xorg-server-1.20.9.tar.bz2 d77151bc51766e1230a121c008ac1d0695275bf889b1db4b3330c1f8ee720b0e046cc935fa14aaef40b02fdea508e84e53959b560131ace14ace14943c8eb734 autoconfig-sis.patch -a5f910e72ff9abd4e4a0c6806cdbe48d1b0b6cc0586f36568da5864a8dedc46a3112fe86d7a1969033f4d5b0def4dc6e5c11b656fbcc964732b417e6c9577f22 fix-musl-arm.patch" +a5f910e72ff9abd4e4a0c6806cdbe48d1b0b6cc0586f36568da5864a8dedc46a3112fe86d7a1969033f4d5b0def4dc6e5c11b656fbcc964732b417e6c9577f22 fix-musl-arm.patch +e38d7323a9046f405f1b568e592f90bb9ed7dd4954480d251431f1e550ea4898d9e6c4bc4bd425ece877464392ed54c92ba582b6f27677fc139a2901209de48a rgb-mask.patch +1abdf004c16ece7e0d1313cbbcbcfdb706d52917ff974b74a4de180fbc0e9d09e6fcc1a3f2b2875885e12d240512679ef0456b8e43bf69ebc1d307be5cd5deaf gcc12.patch" diff --git a/user/xorg-server/gcc12.patch b/user/xorg-server/gcc12.patch new file mode 100644 index 000000000..5aa2f08c6 --- /dev/null +++ b/user/xorg-server/gcc12.patch @@ -0,0 +1,89 @@ +From c6b0dcb82d4db07a2f32c09a8c09c85a5f57248e Mon Sep 17 00:00:00 2001 +From: Olivier Fourdan <ofourdan@redhat.com> +Date: Thu, 20 Jan 2022 10:20:38 +0100 +Subject: [PATCH] render: Fix build with gcc 12 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The xserver fails to compile with the latest gcc 12: + + render/picture.c: In function ‘CreateSolidPicture’: + 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; + | ^~ + render/picture.c:868:45: note: object of size 16 allocated by ‘malloc’ + 868 | pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictSolidFill)); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + render/picture.c: In function ‘CreateLinearGradientPicture’: + 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; + | ^~ + render/picture.c:899:45: note: object of size 32 allocated by ‘malloc’ + 899 | pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictLinearGradient)); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + render/picture.c: In function ‘CreateConicalGradientPicture’: + 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; + | ^~ + 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 + ninja: build stopped: subcommand failed. + +This is because gcc 12 has become stricter and raises a warning now. + +Fix the warning/error by allocating enough memory to store the union +struct. + +Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> +Acked-by: Michel Dänzer <mdaenzer@redhat.com> +Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1256 +--- + render/picture.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/render/picture.c b/render/picture.c +index afa0d258fa..2be4b1954f 100644 +--- a/render/picture.c ++++ b/render/picture.c +@@ -865,7 +865,7 @@ CreateSolidPicture(Picture pid, xRenderColor * color, int *error) + } + + pPicture->id = pid; +- pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictSolidFill)); ++ pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(SourcePict)); + if (!pPicture->pSourcePict) { + *error = BadAlloc; + free(pPicture); +@@ -896,7 +896,7 @@ CreateLinearGradientPicture(Picture pid, xPointFixed * p1, xPointFixed * p2, + } + + pPicture->id = pid; +- pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictLinearGradient)); ++ pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(SourcePict)); + if (!pPicture->pSourcePict) { + *error = BadAlloc; + free(pPicture); +@@ -936,7 +936,7 @@ CreateRadialGradientPicture(Picture pid, xPointFixed * inner, + } + + pPicture->id = pid; +- pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictRadialGradient)); ++ pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(SourcePict)); + if (!pPicture->pSourcePict) { + *error = BadAlloc; + free(pPicture); +@@ -979,7 +979,7 @@ CreateConicalGradientPicture(Picture pid, xPointFixed * center, xFixed angle, + } + + pPicture->id = pid; +- pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictConicalGradient)); ++ pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(SourcePict)); + if (!pPicture->pSourcePict) { + *error = BadAlloc; + free(pPicture); +-- +GitLab + diff --git a/user/xorg-server/rgb-mask.patch b/user/xorg-server/rgb-mask.patch new file mode 100644 index 000000000..a503a6e16 --- /dev/null +++ b/user/xorg-server/rgb-mask.patch @@ -0,0 +1,70 @@ +From 7e142cb2a848acb6af986fa91d254d4c23963b24 Mon Sep 17 00:00:00 2001 +From: luporl <luporl@FreeBSD.org> +Date: Wed, 9 Dec 2020 11:11:15 -0300 +Subject: [PATCH] xserver: fix RGB mask handling + +On FreeBSD 13.0-CURRENT for PowerPC64 big-endian (BE), X was +crashing in some cases. For instance, when twm was started +and the background was clicked to open its menu, X crashed +with a segmentation fault, trying to dereference a null pointer +at CreatePicture(). + +There were 2 issues with xorg-server handling of RGB masks that +caused the pointer above to be null and thus the crash: +- wrong use of ffs() to get the RGB offsets from the masks +- overflow when shifting a 16-bit integer + +This change fixes both issues. They happen when the system is BE +but has a video adapter using a little-endian (LE) ARGB32 +framebuffer. In order to display the correct colors, this setup +requires a BE RGBA32 color format to be used by X, by setting +the RGB masks appropriately, that didn't work properly because of +the issues above. +--- + hw/xfree86/common/xf86Helper.c | 6 +++--- + render/picture.c | 12 ++++++------ + 2 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c +index 31aa068e0e..16ab309e27 100644 +--- a/hw/xfree86/common/xf86Helper.c ++++ b/hw/xfree86/common/xf86Helper.c +@@ -729,9 +729,9 @@ xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask) + scrp->mask.red = mask.red; + scrp->mask.green = mask.green; + scrp->mask.blue = mask.blue; +- scrp->offset.red = ffs(mask.red); +- scrp->offset.green = ffs(mask.green); +- scrp->offset.blue = ffs(mask.blue); ++ scrp->offset.red = ffs(mask.red) - 1; ++ scrp->offset.green = ffs(mask.green) - 1; ++ scrp->offset.blue = ffs(mask.blue) - 1; + } + return TRUE; + } +diff --git a/render/picture.c b/render/picture.c +index 876316dc1c..afa0d258fa 100644 +--- a/render/picture.c ++++ b/render/picture.c +@@ -523,12 +523,12 @@ PictureMatchVisual(ScreenPtr pScreen, int depth, VisualPtr pVisual) + return format; + } + else { +- if (format->direct.redMask << format->direct.red == +- pVisual->redMask && +- format->direct.greenMask << format->direct.green == +- pVisual->greenMask && +- format->direct.blueMask << format->direct.blue == +- pVisual->blueMask) { ++ if ((unsigned long)format->direct.redMask << ++ format->direct.red == pVisual->redMask && ++ (unsigned long)format->direct.greenMask << ++ format->direct.green == pVisual->greenMask && ++ (unsigned long)format->direct.blueMask << ++ format->direct.blue == pVisual->blueMask) { + return format; + } + } +-- +GitLab + |