File: fix_heap_block_overrun

package info (click to toggle)
gatk-bwamem 1.0.4%2Bdfsg2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,260 kB
  • sloc: ansic: 12,321; java: 860; makefile: 126; sh: 36
file content (19 lines) | stat: -rw-r--r-- 663 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
 This is a copy of the patch written for the bwa Debian package.
Last-Update: 2017-06-30

======================================================================
--- a/bwa-apache2/ksw.c
+++ b/bwa-apache2/ksw.c
@@ -385,7 +385,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];