summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2021-08-07 17:24:27 +0100
committerAidan MacDonald <amachronic@protonmail.com>2021-08-10 21:47:04 +0000
commita8063054f90b6f134a8bac089667356b8e974a38 (patch)
tree466d6c7abc4a0a23bfd470c9ecbb4fd4e4adba20
parent614b189f7a13b8099b2198f6ca9ae5917e5c79f1 (diff)
skin engine: handle bitmap read errors appropriately
Change-Id: Ifab0e607cb71afbe26b9e508fe1db3a8730bad4b
-rw-r--r--apps/gui/skin_engine/skin_parser.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 7bcd25d258..a1cc40ff6e 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -1856,8 +1856,14 @@ static int load_skin_bmp(struct wps_data *wps_data, struct bitmap *bitmap, char*
return fd;
}
#ifndef __PCTOOL__
- size_t buf_size = read_bmp_fd(fd, bitmap, 0,
- format|FORMAT_RETURN_SIZE, NULL);
+ int buf_size = read_bmp_fd(fd, bitmap, 0,
+ format|FORMAT_RETURN_SIZE, NULL);
+ if(buf_size < 0)
+ {
+ close(fd);
+ return buf_size;
+ }
+
handle = core_alloc_ex(bitmap->data, buf_size, &buflib_ops);
if (handle <= 0)
{