summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2021-08-02 23:06:40 -0400
committerWilliam Wilgus <wilgus.william@gmail.com>2021-08-02 23:06:40 -0400
commit36e48a8bb262a0e85f5c43f54d12ef617708c0a5 (patch)
treec34f81712c635f6cee753d0c1d8663b43ecbbc0c
parent93c9d675afaecc13ef51945d0992037e55b98724 (diff)
downloadrockbox-36e48a8bb262a0e85f5c43f54d12ef617708c0a5.tar.gz
rockbox-36e48a8bb262a0e85f5c43f54d12ef617708c0a5.tar.bz2
rockbox-36e48a8bb262a0e85f5c43f54d12ef617708c0a5.zip
icon.c guard against negative error values bytesread is copied to an unsigned int for core_shrink
Change-Id: Iff93397e7d6fae8936ef0fdbb1e71df63bcf6531
-rw-r--r--apps/gui/icon.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/apps/gui/icon.c b/apps/gui/icon.c
index 25c0b372fa..46126e830b 100644
--- a/apps/gui/icon.c
+++ b/apps/gui/icon.c
@@ -205,7 +205,7 @@ static void load_icons(const char* filename, enum Iconset iconset,
ic->handle_locked = 0;
/* free unused alpha channel, if any */
- core_shrink(ic->handle, ic->bmp.data, size_read);
+ core_shrink(ic->handle, ic->bmp.data, size_read > 0 ? size_read : 0);
if (size_read <= 0)
ic->handle = core_free(ic->handle);