From 9afcab2ae805b93f04cb4ec303ea6a554afb1971 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 19 Jun 2013 22:52:46 +0200 Subject: [PATCH] regex: fix test for deciding whether to use smatcher or lmatcher smatcher can only be used if the number of states does not exceed the number of bits of type for "states" in smatcher, which is "int". However, the code that tests this condition is formulated in terms of "states1", which is defined to be "states", which in turn is redefined to "char *" before the test. If the size of a "char *" is larger than that of an "int", the test would therefore produce the wrong result. Define "states1" to "int" so that it does not get redefined to "char *". The code was introduced in 29c4dc3 (Wed May 3 10:50:31 2000 +0000). Unfortunately, the commit message does not explain where the code was copied from, so it is not clear if this problem has already been fixed upstream. Reported-by: Donald Allen Signed-off-by: Sven Verdoolaege --- regex/regexec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regex/regexec.c b/regex/regexec.c index 8294b70d..79619d1b 100644 --- a/regex/regexec.c +++ b/regex/regexec.c @@ -63,7 +63,7 @@ static int nope = 0; /* for use in asserts; shuts lint up */ /* macros for manipulating states, small version */ #define states int -#define states1 states /* for later use in regexec() decision */ +#define states1 int /* for later use in regexec() decision */ #define CLEAR(v) ((v) = 0) #define SET0(v, n) ((v) &= ~(1 << (n))) #define SET1(v, n) ((v) |= 1 << (n)) -- 2.11.4.GIT