From cecf7473a6273d6e538e5fcdd918e44a167f0e1f Mon Sep 17 00:00:00 2001 From: jsteube Date: Sun, 18 Sep 2016 22:16:03 +0200 Subject: [PATCH] Make sure *hashconfig and *hashes are initialized before accessing them --- src/status.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/status.c b/src/status.c index 628f909a7..dc3bf7d61 100644 --- a/src/status.c +++ b/src/status.c @@ -172,6 +172,11 @@ double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_en void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *hashes) { + if (opencl_ctx->devices_status == STATUS_INIT) return; + if (opencl_ctx->devices_status == STATUS_STARTING) return; + + if (hashes == NULL) return; + FILE *out = stdout; fprintf (out, "STATUS\t%u\t", opencl_ctx->devices_status); @@ -319,6 +324,9 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c if (opencl_ctx->devices_status == STATUS_INIT) return; if (opencl_ctx->devices_status == STATUS_STARTING) return; + if (hashconfig == NULL) return; + if (hashes == NULL) return; + // in this case some required buffers are free'd, ascii_digest() would run into segfault if (data.shutdown_inner == 1) return; @@ -1149,6 +1157,11 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c void status_benchmark_automate (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig) { + if (opencl_ctx->devices_status == STATUS_INIT) return; + if (opencl_ctx->devices_status == STATUS_STARTING) return; + + if (hashconfig == NULL) return; + u64 speed_cnt[DEVICES_MAX] = { 0 }; double speed_ms[DEVICES_MAX] = { 0 }; @@ -1193,6 +1206,8 @@ void status_benchmark (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig) if (opencl_ctx->devices_status == STATUS_INIT) return; if (opencl_ctx->devices_status == STATUS_STARTING) return; + if (hashconfig == NULL) return; + if (data.shutdown_inner == 1) return; if (data.machine_readable == 1)