Author: Nadiya Sitdykova Description: allocate more memory so the heap block overrun wouldn't happen (when qlen = 0). Issue was spotted by valgrind during investigation of bug https://github.com/lh3/bwa/issues/108 Last-Update: 2017-06-30 ====================================================================== --- bwa.orig/ksw.c +++ bwa/ksw.c @@ -421,7 +421,7 @@ assert(h0 > 0); // allocate memory qp = malloc(qlen * m); - eh = calloc(qlen + 1, 8); + eh = calloc(qlen + 2, 8); // generate the query profile for (k = i = 0; k < m; ++k) { const int8_t *p = &mat[k * m];