@@ -2182,6 +2182,10 @@ static int bcf_record_check(const bcf_hdr_t *hdr, bcf1_t *rec) {
21822182 if (end - ptr < bytes ) goto bad_indiv ;
21832183 ptr += bytes ;
21842184 }
2185+ // if (((size_t)num << bcf_type_shift[type]) * rec->n_sample > INT_MAX) {
2186+ // err |= BCF_ERR_LIMITS;
2187+ // hts_log_warning("Excessive memory required by FORMAT");
2188+ // }
21852189 }
21862190
21872191 if (!err && rec -> rlen < 0 ) {
@@ -3095,7 +3099,7 @@ typedef struct {
30953099 int key ; // Key for h->id[BCF_DT_ID][key] vdict
30963100 int max_m ; // number of elements in field array (ie commas)
30973101 int size ; // field size (max_l or max_g*4 if is_gt)
3098- int offset ; // offset of buf into h->mem
3102+ unsigned int offset ; // offset of buf into h->mem
30993103 uint32_t is_gt :1 , // is genotype
31003104 max_g :31 ; // maximum number of genotypes
31013105 uint32_t max_l ; // length of field
@@ -3326,7 +3330,7 @@ static int vcf_parse_format_alloc4(kstring_t *s, const bcf_hdr_t *h, bcf1_t *v,
33263330 // Limit the total memory to ~2Gb per VCF row. This should mean
33273331 // malformed VCF data is less likely to take excessive memory and/or
33283332 // time.
3329- if ((uint64_t ) mem -> l + v -> n_sample * (uint64_t )f -> size > INT_MAX ) {
3333+ if (0 && (uint64_t ) mem -> l + v -> n_sample * (uint64_t )f -> size > INT_MAX ) {
33303334 static int warned = 0 ;
33313335 if ( !warned ) hts_log_warning ("Excessive memory required by FORMAT fields at %s:%" PRIhts_pos , bcf_seqname_safe (h ,v ), v -> pos + 1 );
33323336 warned = 1 ;
@@ -3342,7 +3346,7 @@ static int vcf_parse_format_alloc4(kstring_t *s, const bcf_hdr_t *h, bcf1_t *v,
33423346 v -> errcode |= BCF_ERR_LIMITS ;
33433347 return -1 ;
33443348 }
3345- mem -> l += v -> n_sample * f -> size ;
3349+ mem -> l += v -> n_sample * ( uint64_t ) f -> size ;
33463350 }
33473351
33483352 {
0 commit comments