commit:     e69ffe486e072430217eb921a1886f93d8d74534
Author:     Philipp Rösner <rndxelement <AT> protonmail <DOT> com>
AuthorDate: Wed Jun 29 19:36:48 2022 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Thu Jun 30 12:43:29 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e69ffe48

app-text/mupdf: fix strict-aliasing violations

Fix two issues in thirdparty/lcms2/src/cmsplugin.c regarding
strinct-aliasing rule violations.

Closes: https://bugs.gentoo.org/855020
Signed-off-by: Philipp Rösner <rndxelement <AT> protonmail.com>
Closes: https://github.com/gentoo/gentoo/pull/26152
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 app-text/mupdf/files/mupdf-1.20.0-lcms2.patch | 20 ++++++++++++++++++++
 app-text/mupdf/mupdf-1.20.0.ebuild            |  1 +
 2 files changed, 21 insertions(+)

diff --git a/app-text/mupdf/files/mupdf-1.20.0-lcms2.patch 
b/app-text/mupdf/files/mupdf-1.20.0-lcms2.patch
new file mode 100644
index 000000000000..a975d42d15e9
--- /dev/null
+++ b/app-text/mupdf/files/mupdf-1.20.0-lcms2.patch
@@ -0,0 +1,20 @@
+--- a/thirdparty/lcms2/src/cmsplugin.c
++++ b/thirdparty/lcms2/src/cmsplugin.c
+@@ -177,7 +177,7 @@ cmsBool CMSEXPORT  _cmsReadFloat32Number(cmsContext 
ContextID, cmsIOHANDLER* io,
+     if (n != NULL) {
+ 
+         tmp = _cmsAdjustEndianess32(tmp);
+-        *n = *(cmsFloat32Number*)(void*)&tmp;
++        *n = (cmsFloat32Number)tmp;
+ 
+         // Safeguard which covers against absurd values
+         if (*n > 1E+20 || *n < -1E+20) return FALSE;
+@@ -308,7 +308,7 @@ cmsBool CMSEXPORT  _cmsWriteFloat32Number(cmsContext 
ContextID, cmsIOHANDLER* io
+ 
+     _cmsAssert(io != NULL);
+ 
+-    tmp = *(cmsUInt32Number*) (void*) &n;
++    tmp = (cmsUInt32Number)n;
+     tmp = _cmsAdjustEndianess32(tmp);
+     if (io -> Write(ContextID, io, sizeof(cmsUInt32Number), &tmp) != 1)
+             return FALSE;

diff --git a/app-text/mupdf/mupdf-1.20.0.ebuild 
b/app-text/mupdf/mupdf-1.20.0.ebuild
index 3d7f8f3e2946..216bbfaa79e7 100644
--- a/app-text/mupdf/mupdf-1.20.0.ebuild
+++ b/app-text/mupdf/mupdf-1.20.0.ebuild
@@ -51,6 +51,7 @@ PATCHES=(
        "${FILESDIR}"/${PN}-1.15-openssl-x11.patch
        # General cross fixes from Debian (refreshed)
        "${FILESDIR}"/${PN}-1.19.0-cross-fixes.patch
+       "${FILESDIR}"/${P}-lcms2.patch
 )
 
 src_prepare() {

Reply via email to