You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace assert() with proper error handling for user-triggerable conditions
assert() is compiled out in release builds (NDEBUG), causing silent
undefined behavior or buffer overflows when triggered by malformed input.
- consensus.c: Replace asserts on variant overlap trimming, unreachable
overlap case, and fasta buffer bounds with error() calls
- convert.c: Replace GT type asserts with warning+skip; add allele index
bounds checks in process_tgt and process_iupac_gt
- vcfconcat.c: Replace bgzf block size assert with error() call
- filter.c: Add NULL check for getenv("HOME") and getenv("HOMEDRIVE")/
getenv("HOMEPATH") in expand_path()
fprintf(stderr,"Warning: skipping GT field with unexpected type %d at %s:%"PRId64"\n", fmt->fmt->type,bcf_seqname(convert->header,line),(int64_t)line->pos+1);
452
+
kputc('.', str);
453
+
return;
454
+
}
450
455
451
456
intl;
452
457
int8_t*x= (int8_t*)(fmt->fmt->p+isample*fmt->fmt->size); // FIXME: does not work with n_alt >= 64
fprintf(stderr,"Warning: allele index %d >= n_allele %d at %s:%"PRId64"\n", ial,line->n_allele,bcf_seqname(convert->header,line),(int64_t)line->pos+1);
467
+
kputc('.', str);
468
+
continue;
469
+
}
459
470
kputs(line->d.allele[ial], str);
460
471
}
461
472
else
@@ -608,7 +619,12 @@ static void process_iupac_gt(convert_t *convert, bcf1_t *line, fmt_t *fmt, int i
608
619
return;
609
620
}
610
621
611
-
assert( fmt->fmt->type==BCF_BT_INT8 );
622
+
if ( fmt->fmt->type!=BCF_BT_INT8 )
623
+
{
624
+
fprintf(stderr,"Warning: skipping GT field with unexpected type %d at %s:%"PRId64"\n", fmt->fmt->type,bcf_seqname(convert->header,line),(int64_t)line->pos+1);
@@ -633,6 +649,12 @@ static void process_iupac_gt(convert_t *convert, bcf1_t *line, fmt_t *fmt, int i
633
649
if (x[l]>>1)
634
650
{
635
651
intial= (x[l]>>1) -1;
652
+
if ( ial >= line->n_allele )
653
+
{
654
+
fprintf(stderr,"Warning: allele index %d >= n_allele %d at %s:%"PRId64"\n", ial,line->n_allele,bcf_seqname(convert->header,line),(int64_t)line->pos+1);
0 commit comments