Skip to content

Commit f981100

Browse files
authored
Fix num overflow (crustio#220)
* Fix number overflow * Fix cast change warning
1 parent eb54656 commit f981100

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/enclave/report/Report.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ crust_status_t get_signed_work_report(const char *block_hash, size_t block_heigh
100100
log_err("Malloc memory failed!\n");
101101
return CRUST_MALLOC_FAILED;
102102
}
103-
uint32_t hashs_len = 0;
103+
size_t hashs_len = 0;
104104
for (auto it : wl->srd_path2hashs_m)
105105
{
106106
for (auto g_hash : it.second)
@@ -118,7 +118,7 @@ crust_status_t get_signed_work_report(const char *block_hash, size_t block_heigh
118118
else
119119
{
120120
srd_workload = (hashs_len / HASH_LENGTH) * 1024 * 1024 * 1024;
121-
sgx_sha256_msg(hashs, hashs_len, &srd_root);
121+
sgx_sha256_msg(hashs, (uint32_t)hashs_len, &srd_root);
122122
}
123123
free(hashs);
124124
sgx_thread_mutex_unlock(&g_srd_mutex);

0 commit comments

Comments
 (0)