mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-06-03 17:08:08 -04:00
psd: Fix segfault on architectures where char is unsigned (like ARM)
This commit is contained in:
parent
ebcc34519c
commit
2a84dd677d
@ -490,11 +490,11 @@ qint64 decompress(const char *input, qint64 ilen, char *output, qint64 olen)
|
|||||||
{
|
{
|
||||||
qint64 j = 0;
|
qint64 j = 0;
|
||||||
for (qint64 ip = 0, rr = 0, available = olen; j < olen && ip < ilen; available = olen - j) {
|
for (qint64 ip = 0, rr = 0, available = olen; j < olen && ip < ilen; available = olen - j) {
|
||||||
char n = input[ip++];
|
signed char n = static_cast<signed char>(input[ip++]);
|
||||||
if (static_cast<signed char>(n) == -128)
|
if (n == -128)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (static_cast<signed char>(n) >= 0) {
|
if (n >= 0) {
|
||||||
rr = qint64(n) + 1;
|
rr = qint64(n) + 1;
|
||||||
if (available < rr) {
|
if (available < rr) {
|
||||||
ip--;
|
ip--;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user