aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Ashburn <jon@lunarg.com>2015-08-27 08:30:50 -0600
committerJon Ashburn <jon@lunarg.com>2015-08-27 13:12:58 -0600
commitb53ea2b246b4e7536689d2f2ff41b536c340a965 (patch)
treeb20dc07c7e1c75dede419daec74645db2cf68c7c
parent88e2aca9850b2e9f5a7f23382f1f3a9bed14776b (diff)
downloadusermoji-b53ea2b246b4e7536689d2f2ff41b536c340a965.tar.xz
loader: Fix SegFault if ICD JSON file doesn't exist to return gracefully
-rw-r--r--loader/loader.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/loader/loader.c b/loader/loader.c
index c612c769..87e854d3 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -1203,6 +1203,10 @@ static cJSON *loader_get_json(const char *filename)
cJSON *json;
uint64_t len;
file = fopen(filename,"rb");
+ if (!file) {
+ loader_log(VK_DBG_REPORT_ERROR_BIT, 0, "Couldn't open JSON file %s", filename);
+ return NULL;
+ }
fseek(file, 0, SEEK_END);
len = ftell(file);
fseek(file, 0, SEEK_SET);
@@ -1682,6 +1686,8 @@ void loader_icd_scan(struct loader_icd_libs *icds)
cJSON *json;
json = loader_get_json(file_str);
+ if (!json)
+ continue;
cJSON *item;
item = cJSON_GetObjectItem(json, "file_format_version");
if (item == NULL)