!169 Fix build with gcc 12
From: @leeffo Reviewed-by: @weidongkl, @t_feng Signed-off-by: @t_feng
This commit is contained in:
commit
50d7d73bc2
89
render-fix-build-with-gcc12.patch
Normal file
89
render-fix-build-with-gcc12.patch
Normal file
@ -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
|
||||||
|
|
||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
Name: xorg-x11-server
|
Name: xorg-x11-server
|
||||||
Version: 1.20.11
|
Version: 1.20.11
|
||||||
Release: 19
|
Release: 20
|
||||||
Summary: X.Org X11 X server
|
Summary: X.Org X11 X server
|
||||||
License: MIT and GPLv2
|
License: MIT and GPLv2
|
||||||
URL: https://www.x.org
|
URL: https://www.x.org
|
||||||
@ -105,6 +105,8 @@ Patch6018: backport-CVE-2022-4283.patch
|
|||||||
Patch6019: backport-CVE-2023-0494.patch
|
Patch6019: backport-CVE-2023-0494.patch
|
||||||
Patch6020: backport-CVE-2023-1393.patch
|
Patch6020: backport-CVE-2023-1393.patch
|
||||||
Patch6021: backport-CVE-2022-3550.patch
|
Patch6021: backport-CVE-2022-3550.patch
|
||||||
|
# Fix build with gcc 12
|
||||||
|
Patch6022: render-fix-build-with-gcc12.patch
|
||||||
|
|
||||||
BuildRequires: audit-libs-devel autoconf automake bison dbus-devel flex git gcc
|
BuildRequires: audit-libs-devel autoconf automake bison dbus-devel flex git gcc
|
||||||
BuildRequires: systemtap-sdt-devel libtool pkgconfig
|
BuildRequires: systemtap-sdt-devel libtool pkgconfig
|
||||||
@ -445,6 +447,9 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete
|
|||||||
%{_mandir}/man*/*
|
%{_mandir}/man*/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Jul 13 2023 leeffo <liweiganga@uniontech.com> -1.20.11-20
|
||||||
|
- Fix build with gcc 12
|
||||||
|
|
||||||
* Fri May 26 2023 leeffo <liweiganga@uniontech.com> -1.20.11-19
|
* Fri May 26 2023 leeffo <liweiganga@uniontech.com> -1.20.11-19
|
||||||
- fix CVE-2022-3550
|
- fix CVE-2022-3550
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user