From 77c76c1e143e724cdc2544e3c6b247dcda3fe68c Mon Sep 17 00:00:00 2001 From: Heng Li Date: Tue, 6 Jun 2017 22:20:45 -0400 Subject: [PATCH] fixed an integer overflow --- chain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chain.c b/chain.c index ba5ae5f..aa9d573 100644 --- a/chain.c +++ b/chain.c @@ -89,7 +89,7 @@ int mm_chain_dp(int max_dist, int bw, int max_skip, int min_sc, int n, mm128_t * j = p[j]; } while (j >= 0 && t[j] == 0); if (j < 0) u[k++] = u[i]>>32<<32 | (n_v - n_v0); - else if ((u[i]>>32) - f[j] >= min_sc) u[k++] = ((u[i]>>32) - f[j]) << 32 | (n_v - n_v0); + else if ((int32_t)(u[i]>>32) - f[j] >= min_sc) u[k++] = ((u[i]>>32) - f[j]) << 32 | (n_v - n_v0); else n_v0 = n_v; for (j = 0; j < (n_v - n_v0) >> 1; ++j) { // reverse v[] such that the smallest index comes the first int32_t t = v[n_v0 + j];