Unbreak utf8clean testcase.
authorJeremy Harris <jgh146exb@wizmail.org>
Sun, 17 Aug 2014 17:26:08 +0000 (18:26 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Sun, 17 Aug 2014 17:32:07 +0000 (18:32 +0100)
Broken by my compile quitening; the issue was a variable
declared local in a loop body and used for carrying data
from one iteration to the next.  I'd blindly added an
initialiser, destroying the data.  However, I *think* that
compilers might be at liberty to not use the same location
for separate iterations; if so the code was broken (and only
worked by chance).  Fix by moving the declaration outside
the loop.

src/src/expand.c
test/confs/0600

index ba2c6f7cdc61fdb6de6de9b43ff1db5878f1438b..b0e76ba27fe2da246daf1e6f43f4ab74e5d96440 100644 (file)
@@ -6376,16 +6376,14 @@ while (*s != 0)
         {
         int seq_len = 0, index = 0;
         int bytes_left = 0;
+       long codepoint = -1;
         uschar seq_buff[4];                    /* accumulate utf-8 here */
         
         while (*sub != 0)
          {
-         int complete;
-         long codepoint = 0;
-         uschar c;
+         int complete = 0;
+         uschar c = *sub++;
 
-         complete = 0;
-         c = *sub++;
          if (bytes_left)
            {
            if ((c & 0xc0) != 0x80)
@@ -6400,7 +6398,7 @@ while (*s != 0)
              if (--bytes_left == 0)            /* codepoint complete */
                {
                if(codepoint > 0x10FFFF)        /* is it too large? */
-                 complete = -1;        /* error */
+                 complete = -1;        /* error (RFC3629 limit) */
                else
                  {             /* finished; output utf-8 sequence */
                  yield = string_cat(yield, &size, &ptr, seq_buff, seq_len);
index 0347e4c60d7eaf98b071a235875301f37a5dffb2..61a9c0801f4aa2d09f9827cf58b165ec17178c49 100644 (file)
@@ -1,4 +1,5 @@
-# Exim test configuration 0005
+# Exim test configuration 0600
+# utf8clean:string
 
 exim_path = EXIM_PATH
 host_lookup_order = bydns