From f0423719589a366f7b599ccfea9f45d461c9728c Mon Sep 17 00:00:00 2001 From: Christopher Chang Date: Thu, 21 Sep 2023 11:37:43 -0700 Subject: [PATCH] .sample parsing bugfix --- 2.0/plink2_import.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/2.0/plink2_import.cc b/2.0/plink2_import.cc index 193b76f2..6f79979e 100644 --- a/2.0/plink2_import.cc +++ b/2.0/plink2_import.cc @@ -9429,7 +9429,8 @@ PglErr OxSampleToPsam(const char* samplename, const char* const_fid, const char* uintptr_t* col_first_pass_remaining; uintptr_t* col_nm; unsigned char* col_types; - if (unlikely(bigstack_alloc_w(col_ctl, &col_first_pass_remaining) || + // bugfix (21 Sep 2023): forgot to 0-initialize col_first_pass_remaining + if (unlikely(bigstack_calloc_w(col_ctl, &col_first_pass_remaining) || bigstack_calloc_w(col_ctl, &col_nm) || bigstack_alloc_uc(col_ct, &col_types))) { goto OxSampleToPsam_ret_NOMEM; @@ -9586,6 +9587,7 @@ PglErr OxSampleToPsam(const char* samplename, const char* const_fid, const char* const uint32_t col_uidx = BitIter1(col_first_pass_remaining, &col_uidx_base, &cur_bits); linebuf_iter = NextTokenMult(token_end, col_uidx - prev_col_uidx); if (unlikely(!linebuf_iter)) { + printf("fail 2 %u %u %u\n", col_uidx, prev_col_uidx, uii); goto OxSampleToPsam_ret_MISSING_TOKENS; } prev_col_uidx = col_uidx;