From fed836b3bfd7f84c2054616037d002570c7f407c Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Tue, 7 Dec 2010 15:21:55 -0700 Subject: [PATCH] regcomp.c: When inverting a [], adjust bit count When one complements every bit, the count of those that are set should be complemented as well. --- regcomp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/regcomp.c b/regcomp.c index e450ec2..0e3f6ba 100644 --- a/regcomp.c +++ b/regcomp.c @@ -8933,6 +8933,9 @@ parseit: if ((ANYOF_FLAGS(ret) & ANYOF_FLAGS_ALL) == ANYOF_INVERT) { for (value = 0; value < ANYOF_BITMAP_SIZE; ++value) ANYOF_BITMAP(ret)[value] ^= 0xFF; + stored = 256 - stored; + + /* The inversion means that everything above 255 is matched */ ANYOF_FLAGS(ret) = ANYOF_UTF8|ANYOF_UNICODE_ALL; } -- 2.7.4