Skip to content

Commit afa5325

Browse files
committed
Update the news to clarify S3 bug fix.
It's useful to be explicit on which htslib versions were affected by this bug. Fixes #2043 Signed-off-by: James Bonfield <jkb@sanger.ac.uk>
1 parent 942f3be commit afa5325

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

NEWS

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ Bug fixes
7474
(PR #1992, PR #1993, PR #2004, PR #2010)
7575

7676
* Fix s3_seek returning wrong offset on cache-hit.
77-
(PR #2012. Thanks to Nick Edwards)
77+
This caused unreliability reading of S3 data when using the
78+
multi-region iterator. The bug affects 1.23 and 1.23.1.
79+
Releases prior to 1.23 were unaffected.
80+
(PR #2012. Thanks to Nick Edwards.
81+
Also fixes #2043 reported by Andrew J. Tock.)
7882

7983
* Remove a signed overflow bug in bgzf_read_small.
8084
(PR #2013)

vcf.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)