Merge pull request #51 from z3n-chada/memset-settings

Memset Settings structs before modifying them
This commit is contained in:
Ramana Kumar 2022-12-25 07:12:07 +00:00 committed by GitHub
commit 6b0bdeac75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -663,6 +663,8 @@ static C_KZG_RET new_fft_settings(FFTSettings *fs, unsigned int max_scale) {
C_KZG_RET ret;
fr_t root_of_unity;
memset(fs, 0, sizeof(FFTSettings));
fs->max_width = (uint64_t)1 << max_scale;
CHECK((max_scale < sizeof scale2_root_of_unity / sizeof scale2_root_of_unity[0]));
@ -785,6 +787,8 @@ C_KZG_RET load_trusted_setup(KZGSettings *out, const uint8_t g1_bytes[], size_t
g1_t *g1_projective = NULL;
C_KZG_RET ret;
memset(out, 0, sizeof(KZGSettings));
ret = new_g1_array(&out->g1_values, n1);
if (ret != C_KZG_OK) goto out_error;
ret = new_g2_array(&out->g2_values, n2);