Skip to content

Commit

Permalink
Release 1.4.1: summary
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferliddle committed May 8, 2017
2 parents d2d9c76 + 89ea70a commit 6c06833
Show file tree
Hide file tree
Showing 28 changed files with 829 additions and 452 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ lib*.so.*
/test/test-regidx
/test/test-vcf-api
/test/test-vcf-sweep
/test/test-bcf-sr
/test/test_view
/test/thrash_threads[1-6]
/test/*.tmp
Expand Down
48 changes: 25 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ htslib_default_libs = -lz -lm -lbz2 -llzma

CPPFLAGS =
# TODO: probably update cram code to make it compile cleanly with -Wc++-compat
# For testing strict C99 support add -std=c99 -D_XOPEN_SOURCE=600
#CFLAGS = -g -Wall -O2 -pedantic -std=c99 -D_XOPEN_SOURCE=600 -D__FUNCTION__=__func__
CFLAGS = -g -Wall -O2
EXTRA_CFLAGS_PIC = -fpic
LDFLAGS =
Expand Down Expand Up @@ -90,7 +92,7 @@ HTSPREFIX =
include htslib_vars.mk


PACKAGE_VERSION = 1.4
PACKAGE_VERSION = 1.4.1
LIBHTS_SOVERSION = 2


Expand Down Expand Up @@ -262,7 +264,7 @@ print-config:
# file used at runtime (when $LD_LIBRARY_PATH includes the build directory).

libhts.so: $(LIBHTS_OBJS:.o=.pico)
$(CC) -shared -Wl,-soname,libhts.so.$(LIBHTS_SOVERSION) -pthread $(LDFLAGS) -o $@ $(LIBHTS_OBJS:.o=.pico) $(LIBS)
$(CC) -shared -Wl,-soname,libhts.so.$(LIBHTS_SOVERSION) $(LDFLAGS) -o $@ $(LIBHTS_OBJS:.o=.pico) $(LIBS) -lpthread
ln -sf $@ libhts.so.$(LIBHTS_SOVERSION)

# Similarly this also creates libhts.NN.dylib as a byproduct, so that programs
Expand All @@ -274,11 +276,11 @@ libhts.dylib: $(LIBHTS_OBJS)
ln -sf $@ libhts.$(LIBHTS_SOVERSION).dylib

cyghts-$(LIBHTS_SOVERSION).dll: $(LIBHTS_OBJS)
$(CC) -shared -Wl,--out-implib=libhts.dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -pthread $(LDFLAGS) -o $@ -Wl,--whole-archive $(LIBHTS_OBJS) -Wl,--no-whole-archive $(LIBS)
$(CC) -shared -Wl,--out-implib=libhts.dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import $(LDFLAGS) -o $@ -Wl,--whole-archive $(LIBHTS_OBJS) -Wl,--no-whole-archive $(LIBS) -lpthread


.pico.so:
$(CC) -shared -Wl,-E -pthread $(LDFLAGS) -o $@ $< $(LIBS)
$(CC) -shared -Wl,-E $(LDFLAGS) -o $@ $< $(LIBS) -lpthread

.o.bundle:
$(CC) -bundle -Wl,-undefined,dynamic_lookup $(LDFLAGS) -o $@ $< $(LIBS)
Expand Down Expand Up @@ -335,13 +337,13 @@ cram/zfio.o cram/zfio.pico: cram/zfio.c config.h $(cram_os_h) cram/zfio.h


bgzip: bgzip.o libhts.a
$(CC) -pthread $(LDFLAGS) -o $@ bgzip.o libhts.a $(LIBS)
$(CC) $(LDFLAGS) -o $@ bgzip.o libhts.a $(LIBS) -lpthread

htsfile: htsfile.o libhts.a
$(CC) -pthread $(LDFLAGS) -o $@ htsfile.o libhts.a $(LIBS)
$(CC) $(LDFLAGS) -o $@ htsfile.o libhts.a $(LIBS) -lpthread

tabix: tabix.o libhts.a
$(CC) -pthread $(LDFLAGS) -o $@ tabix.o libhts.a $(LIBS)
$(CC) $(LDFLAGS) -o $@ tabix.o libhts.a $(LIBS) -lpthread

bgzip.o: bgzip.c config.h $(htslib_bgzf_h) $(htslib_hts_h)
htsfile.o: htsfile.c config.h $(htslib_hfile_h) $(htslib_hts_h) $(htslib_sam_h) $(htslib_vcf_h)
Expand All @@ -350,7 +352,7 @@ tabix.o: tabix.c config.h $(htslib_tbx_h) $(htslib_sam_h) $(htslib_vcf_h) $(htsl

# For tests that might use it, set $REF_PATH explicitly to use only reference
# areas within the test suite (or set it to ':' to use no reference areas).
check test: bgzip htsfile $(BUILT_TEST_PROGRAMS)
check test: $(BUILT_PROGRAMS) $(BUILT_TEST_PROGRAMS)
test/hts_endian
test/fieldarith test/fieldarith.sam
test/hfile
Expand All @@ -364,31 +366,31 @@ test/hts_endian: test/hts_endian.o
$(CC) $(LDFLAGS) -o $@ test/hts_endian.o $(LIBS)

test/fieldarith: test/fieldarith.o libhts.a
$(CC) -pthread $(LDFLAGS) -o $@ test/fieldarith.o libhts.a $(LIBS)
$(CC) $(LDFLAGS) -o $@ test/fieldarith.o libhts.a $(LIBS) -lpthread

test/hfile: test/hfile.o libhts.a
$(CC) -pthread $(LDFLAGS) -o $@ test/hfile.o libhts.a $(LIBS)
$(CC) $(LDFLAGS) -o $@ test/hfile.o libhts.a $(LIBS) -lpthread

test/sam: test/sam.o libhts.a
$(CC) -pthread $(LDFLAGS) -o $@ test/sam.o libhts.a $(LIBS)
$(CC) $(LDFLAGS) -o $@ test/sam.o libhts.a $(LIBS) -lpthread

test/test_bgzf: test/test_bgzf.o libhts.a
$(CC) -pthread $(LDFLAGS) -o $@ test/test_bgzf.o libhts.a -lz $(LIBS)
$(CC) $(LDFLAGS) -o $@ test/test_bgzf.o libhts.a -lz $(LIBS) -lpthread

test/test-regidx: test/test-regidx.o libhts.a
$(CC) -pthread $(LDFLAGS) -o $@ test/test-regidx.o libhts.a $(LIBS)
$(CC) $(LDFLAGS) -o $@ test/test-regidx.o libhts.a $(LIBS) -lpthread

test/test_view: test/test_view.o libhts.a
$(CC) -pthread $(LDFLAGS) -o $@ test/test_view.o libhts.a $(LIBS)
$(CC) $(LDFLAGS) -o $@ test/test_view.o libhts.a $(LIBS) -lpthread

test/test-vcf-api: test/test-vcf-api.o libhts.a
$(CC) -pthread $(LDFLAGS) -o $@ test/test-vcf-api.o libhts.a $(LIBS)
$(CC) $(LDFLAGS) -o $@ test/test-vcf-api.o libhts.a $(LIBS) -lpthread

test/test-vcf-sweep: test/test-vcf-sweep.o libhts.a
$(CC) -pthread $(LDFLAGS) -o $@ test/test-vcf-sweep.o libhts.a $(LIBS)
$(CC) $(LDFLAGS) -o $@ test/test-vcf-sweep.o libhts.a $(LIBS) -lpthread

test/test-bcf-sr: test/test-bcf-sr.o libhts.a
$(CC) -pthread $(LDFLAGS) -o $@ test/test-bcf-sr.o libhts.a -lz $(LIBS)
$(CC) $(LDFLAGS) -o $@ test/test-bcf-sr.o libhts.a -lz $(LIBS) -lpthread

test/hts_endian.o: test/hts_endian.c $(htslib_hts_endian_h)
test/fieldarith.o: test/fieldarith.c config.h $(htslib_sam_h)
Expand All @@ -403,22 +405,22 @@ test/test-bcf-sr.o: test/test-bcf-sr.c config.h $(htslib_vcf_sweep_h) bcf_sr_sor


test/thrash_threads1: test/thrash_threads1.o libhts.a
$(CC) -pthread $(LDFLAGS) -o $@ test/thrash_threads1.o libhts.a -lz $(LIBS)
$(CC) $(LDFLAGS) -o $@ test/thrash_threads1.o libhts.a -lz $(LIBS) -lpthread

test/thrash_threads2: test/thrash_threads2.o libhts.a
$(CC) -pthread $(LDFLAGS) -o $@ test/thrash_threads2.o libhts.a -lz $(LIBS)
$(CC) $(LDFLAGS) -o $@ test/thrash_threads2.o libhts.a -lz $(LIBS) -lpthread

test/thrash_threads3: test/thrash_threads3.o libhts.a
$(CC) -pthread $(LDFLAGS) -o $@ test/thrash_threads3.o libhts.a -lz $(LIBS)
$(CC) $(LDFLAGS) -o $@ test/thrash_threads3.o libhts.a -lz $(LIBS) -lpthread

test/thrash_threads4: test/thrash_threads4.o libhts.a
$(CC) -pthread $(LDFLAGS) -o $@ test/thrash_threads4.o libhts.a -lz $(LIBS)
$(CC) $(LDFLAGS) -o $@ test/thrash_threads4.o libhts.a -lz $(LIBS) -lpthread

test/thrash_threads5: test/thrash_threads5.o libhts.a
$(CC) -pthread $(LDFLAGS) -o $@ test/thrash_threads5.o libhts.a -lz $(LIBS)
$(CC) $(LDFLAGS) -o $@ test/thrash_threads5.o libhts.a -lz $(LIBS) -lpthread

test/thrash_threads6: test/thrash_threads6.o libhts.a
$(CC) -pthread $(LDFLAGS) -o $@ test/thrash_threads6.o libhts.a -lz $(LIBS)
$(CC) $(LDFLAGS) -o $@ test/thrash_threads6.o libhts.a -lz $(LIBS) -lpthread

test_thrash: $(BUILT_THRASH_PROGRAMS)

Expand Down
22 changes: 21 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
Noteworthy changes in release 1.4
Noteworthy changes in release 1.4.1 (8th May 2017)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is primarily a security bug fix update.

* Fixed SECURITY issue with buffer overruns with malicious data. (#514).

* S3 support for non Amazon AWS endpoints. (#506)

* Support for variant breakpoints in bcftools. (#516)

* Improved handling of BCF NaNs. (#485)

* Compilation / portability improvements. (#255, #423, #498, #488)

* Miscellaneous bug fixes (#482, #521, #522, #523, #524).

* Sanitise headers (#509)


Release 1.4 (13 March 2017)

* Incompatible changes: several functions and data types have been changed
in this release, and the shared library soversion has been bumped to 2.
Expand Down
2 changes: 2 additions & 0 deletions bcf_sr_sort.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
THE SOFTWARE.
*/

#include <strings.h>

#include "bcf_sr_sort.h"
#include "htslib/khash_str2int.h"

Expand Down
11 changes: 10 additions & 1 deletion bgzf.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ static BGZF *bgzf_read_init(hFILE *hfpr)
}

// get the compress level from the mode string: compress_level==-1 for the default level, -2 plain uncompressed
static int mode2level(const char *__restrict mode)
static int mode2level(const char *mode)
{
int i, compress_level = -1;
for (i = 0; mode[i]; ++i)
Expand Down Expand Up @@ -837,6 +837,11 @@ int bgzf_read_block(BGZF *fp)
}
size = count;
block_length = unpackInt16((uint8_t*)&header[16]) + 1; // +1 because when writing this number, we used "-1"
if (block_length < BLOCK_HEADER_LENGTH)
{
fp->errcode |= BGZF_ERR_HEADER;
return -1;
}
compressed_block = (uint8_t*)fp->compressed_block;
memcpy(compressed_block, header, BLOCK_HEADER_LENGTH);
remaining = block_length - BLOCK_HEADER_LENGTH;
Expand Down Expand Up @@ -1049,6 +1054,10 @@ int bgzf_mt_read_block(BGZF *fp, bgzf_job *j)

size = count;
block_length = unpackInt16((uint8_t*)&header[16]) + 1; // +1 because when writing this number, we used "-1"
if (block_length < BLOCK_HEADER_LENGTH) {
j->errcode |= BGZF_ERR_HEADER;
return -1;
}
compressed_block = (uint8_t*)j->comp_data;
memcpy(compressed_block, header, BLOCK_HEADER_LENGTH);
remaining = block_length - BLOCK_HEADER_LENGTH;
Expand Down
1 change: 0 additions & 1 deletion bgzip.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,5 +333,4 @@ int main(int argc, char **argv)
if (!pstdout) unlink(argv[optind]);
return 0;
}
return 0;
}
5 changes: 5 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ is installed.
FAILED. This error must be resolved in order to build HTSlib successfully.])
fi

dnl connect() etc. fns are in libc on linux, but libsocket on illumos/Solaris
libsocket=unneeded
AC_SEARCH_LIBS(connect, socket, [libsocket=needed], [])


if test "$enable_bz2" != no; then
bz2_devel=ok
AC_CHECK_HEADER([bzlib.h], [], [bz2_devel=missing], [;])
Expand Down
23 changes: 19 additions & 4 deletions cram/cram_codecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <string.h>
#include <assert.h>
#include <limits.h>
#include <stdint.h>
#include <errno.h>

#include "cram/cram.h"

Expand Down Expand Up @@ -991,6 +993,15 @@ cram_codec *cram_huffman_decode_init(char *data, int size,
}

cp += safe_itf8_get(cp, data_end, &ncodes);
if (ncodes < 0) {
fprintf(stderr, "Invalid number of symbols in huffman stream\n");
return NULL;
}
if (ncodes >= SIZE_MAX / sizeof(*codes)) {
errno = ENOMEM;
return NULL;
}

h = calloc(1, sizeof(*h));
if (!h)
return NULL;
Expand All @@ -999,10 +1010,14 @@ cram_codec *cram_huffman_decode_init(char *data, int size,
h->free = cram_huffman_decode_free;

h->huffman.ncodes = ncodes;
codes = h->huffman.codes = malloc(ncodes * sizeof(*codes));
if (!codes) {
free(h);
return NULL;
if (ncodes) {
codes = h->huffman.codes = malloc(ncodes * sizeof(*codes));
if (!codes) {
free(h);
return NULL;
}
} else {
codes = h->huffman.codes = NULL;
}

/* Read symbols and bit-lengths */
Expand Down
4 changes: 4 additions & 0 deletions cram/cram_decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2279,6 +2279,10 @@ int cram_decode_slice(cram_fd *fd, cram_container *c, cram_slice *s,
s->ref = (char *)BLOCK_DATA(b);
s->ref_start = s->hdr->ref_seq_start;
s->ref_end = s->hdr->ref_seq_start + s->hdr->ref_seq_span-1;
if (s->ref_end - s->ref_start > b->uncomp_size) {
fprintf(stderr, "Embedded reference is too small.\n");
return -1;
}
} else if (!fd->no_ref) {
//// Avoid Java cramtools bug by loading entire reference seq
//s->ref = cram_get_ref(fd, s->hdr->ref_seq_id, 1, 0);
Expand Down
Loading

0 comments on commit 6c06833

Please sign in to comment.