minimap2
minimap2 copied to clipboard
Undefined behaviour
Using mm2 v2.26 in pbmm2
, I fail at
lchain.c:228:1: runtime error: index -1 out of bounds for type 'const lc_elem_t *[64]' (aka 'const struct lc_elem_s *[64]')
How to reproduce
git clone https://github.com/PacificBiosciences/pbmm2 pbmm2
cd pbmm2
mkdir build
cd build
meson setup --buildtype=debugoptimized -Db_sanitize=address,undefined -Db_lundef=false
ninja
ninja test
If I unfold the macros, I get to this line, but not sure if it's the correct line: https://github.com/lh3/minimap2/blob/ace990c381c647d6cf8fae7a4941a7b56fb67ae7/krmq.h#L354
See also #1029. I believe this is a false positive of ubsan because itr->stack-1
is never accessed. Nonetheless, I can reopen and merge #1029 just to make ubsan happy.
I would appreciate if the code passes sanitizers. Thank you