icon.c guard against negative error values bytesread is copied to an unsigned int for core_shrink

Change-Id: Iff93397e7d6fae8936ef0fdbb1e71df63bcf6531
This commit is contained in:
William Wilgus 2021-08-02 23:06:40 -04:00
parent 93c9d675af
commit 36e48a8bb2
1 changed files with 1 additions and 1 deletions

View File

@ -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);