From 07af79bf63973ed728a3fd4ded1369e359e7c79d Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 16 Jun 2014 17:29:17 +0200 Subject: Prevent read past start of array --- src/whirligig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/whirligig.c b/src/whirligig.c index ea78edb8..2d36839b 100644 --- a/src/whirligig.c +++ b/src/whirligig.c @@ -311,7 +311,7 @@ int main(int argc, char *argv[]) pos--; } - if ( (ser[pos] == -1) && (ser[pos-1] == -1) ) { + if ( (pos > 0) && (ser[pos] == -1) && (ser[pos-1] == -1) ) { /* Series ready to process */ process_series(win, ser, mat, pos-2); dump(win, ser, mat, window_len, pos); -- cgit v1.2.3