From 5e55e397e98ad95019a7aac2d974180cea237cc0 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Mon, 5 Nov 2018 23:36:12 -0500 Subject: [PATCH] r882: guard against -E0 (#263) --- main.c | 2 +- options.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index eee5415..cb6f6dc 100644 --- a/main.c +++ b/main.c @@ -6,7 +6,7 @@ #include "mmpriv.h" #include "ketopt.h" -#define MM_VERSION "2.13-r881-dirty" +#define MM_VERSION "2.13-r882-dirty" #ifdef __linux__ #include diff --git a/options.c b/options.c index c7f0eeb..b6d9004 100644 --- a/options.c +++ b/options.c @@ -159,6 +159,11 @@ int mm_check_opt(const mm_idxopt_t *io, const mm_mapopt_t *mo) fprintf(stderr, "[ERROR]\033[1;31m --for-only and --rev-only can't be applied at the same time\033[0m\n"); return -3; } + if (mo->e <= 0 || mo->q <= 0) { + if (mm_verbose >= 1) + fprintf(stderr, "[ERROR]\033[1;31m -O and -E must be positive\033[0m\n"); + return -1; + } if ((mo->q != mo->q2 || mo->e != mo->e2) && !(mo->e > mo->e2 && mo->q + mo->e < mo->q2 + mo->e2)) { if (mm_verbose >= 1) fprintf(stderr, "[ERROR]\033[1;31m dual gap penalties violating E1>E2 and O1+E1