From 2a84dd677db53729be5862503ac56c5139086bb3 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Fri, 27 May 2022 12:26:56 +0300 Subject: [PATCH] psd: Fix segfault on architectures where char is unsigned (like ARM) --- src/imageformats/psd.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/imageformats/psd.cpp b/src/imageformats/psd.cpp index 49f2abd..e70c572 100644 --- a/src/imageformats/psd.cpp +++ b/src/imageformats/psd.cpp @@ -490,11 +490,11 @@ qint64 decompress(const char *input, qint64 ilen, char *output, qint64 olen) { qint64 j = 0; for (qint64 ip = 0, rr = 0, available = olen; j < olen && ip < ilen; available = olen - j) { - char n = input[ip++]; - if (static_cast(n) == -128) + signed char n = static_cast(input[ip++]); + if (n == -128) continue; - if (static_cast(n) >= 0) { + if (n >= 0) { rr = qint64(n) + 1; if (available < rr) { ip--;