[exim-cvs] Unbreak utf8clean testcase.

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Exim Git Commits Mailing List
Date:  
À: exim-cvs
Sujet: [exim-cvs] Unbreak utf8clean testcase.
Gitweb: http://git.exim.org/exim.git/commitdiff/e8e86723959ffd4ab6d6b320538ec0e86f828798
Commit:     e8e86723959ffd4ab6d6b320538ec0e86f828798
Parent:     770feb2f08f38dc1ac8e484659c60c8dd76d370c
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Sun Aug 17 18:26:08 2014 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Sun Aug 17 18:32:07 2014 +0100


    Unbreak utf8clean testcase.


    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 |   10 ++++------
 test/confs/0600  |    3 ++-
 2 files changed, 6 insertions(+), 7 deletions(-)


diff --git a/src/src/expand.c b/src/src/expand.c
index ba2c6f7..b0e76ba 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -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);
diff --git a/test/confs/0600 b/test/confs/0600
index 0347e4c..61a9c08 100644
--- a/test/confs/0600
+++ b/test/confs/0600
@@ -1,4 +1,5 @@
-# Exim test configuration 0005
+# Exim test configuration 0600
+# utf8clean:string


exim_path = EXIM_PATH
host_lookup_order = bydns