regcomp.c: When inverting a [], adjust bit count
authorKarl Williamson <public@khwilliamson.com>
Tue, 7 Dec 2010 22:21:55 +0000 (15:21 -0700)
committerKarl Williamson <public@khwilliamson.com>
Sat, 11 Dec 2010 22:57:53 +0000 (15:57 -0700)
When one complements every bit, the count of those that are set should
be complemented as well.

regcomp.c

index e450ec2..0e3f6ba 100644 (file)
--- 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;
     }