Fwd: [graphics/krita/krita/5.1] libs/psdutils: PSD: fix using implementation-defined signedness when decompressing RLE

Halla Rempt halla at valdyas.org
Sat Jan 21 08:56:59 GMT 2023


Does this mean that 5.1.5 is also broken on Apple M1? If so, what can we do here? For Android we could try to roll back to 5.1.4, I guess? 

We can build 5.1.6 against Qt 5.16, but that sounds pretty dangerous...


----------  Forwarded Message  ----------

Subject: [graphics/krita/krita/5.1] libs/psdutils: PSD: fix using implementation-defined signedness when decompressing RLE
Date: zaterdag 14 januari 2023, 13:30:03 CET
From: L.  E.  Segovia <null at kde.org>
To: kde-commits at kde.org

Git commit 4e69b49f8bbfc8feebf727e6410018521d12c040 by L. E. Segovia.
Committed on 14/01/2023 at 12:29.
Pushed by lsegovia into branch 'krita/5.1'.

PSD: fix using implementation-defined signedness when decompressing RLE

BUG: 464015
(cherry picked from commit 0abf00babfa80689521a67fcdb4527fc980d25f7)

M  +3    -2    libs/psdutils/compression.cpp

https://invent.kde.org/graphics/krita/commit/4e69b49f8bbfc8feebf727e6410018521d12c040

diff --git a/libs/psdutils/compression.cpp b/libs/psdutils/compression.cpp
index cca5415090..2b4b611acd 100644
--- a/libs/psdutils/compression.cpp
+++ b/libs/psdutils/compression.cpp
@@ -93,7 +93,8 @@ QByteArray decompress(const QByteArray &input, int unpacked_len)
     auto *dst = output.begin();
 
     while (src < input.end() && dst < output.end()) {
-        const char n = *src; // NOLINT(readability-identifier-length)
+        // NOLINTNEXTLINE(*-reinterpret-cast,readability-identifier-length)
+        const int8_t n = *reinterpret_cast<const int8_t *>(src);
         src += 1;
 
         if (n >= 0) { // copy next n+1 chars
@@ -119,7 +120,7 @@ QByteArray decompress(const QByteArray &input, int unpacked_len)
                 errFile << "Output buffer exhausted in copy of" << bytes << "chars, left" << (output.end() - dst);
                 return {};
             }
-            const char byte = *src;
+            const auto byte = *src;
             std::fill_n(dst, bytes, byte);
             src += 1;
             dst += bytes;

-----------------------------------------




More information about the kimageshop mailing list