changeset 4688:7e54adf407a1

Fix a bug with Unicode error sequences and very short input strings. src/ChangeLog addition: 2009-09-11 Aidan Kehoe <kehoea@parhasard.net> * unicode.c (unicode_convert): Fix a bug with error sequences and very short input strings. tests/ChangeLog addition: 2009-09-11 Aidan Kehoe <kehoea@parhasard.net> * automated/mule-tests.el (featurep): Check that a Unicode bug with very short inputs has been fixed.
author Aidan Kehoe <kehoea@parhasard.net>
date Fri, 11 Sep 2009 17:54:07 +0100
parents 02b7c7189041
children 0636c6ccb430
files src/ChangeLog src/unicode.c tests/ChangeLog tests/automated/mule-tests.el
diffstat 4 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sun Sep 06 23:47:12 2009 +0100
+++ b/src/ChangeLog	Fri Sep 11 17:54:07 2009 +0100
@@ -1,3 +1,8 @@
+2009-09-11  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* unicode.c (unicode_convert): 
+	Fix a bug with error sequences and very short input strings.
+
 2009-08-31  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* eval.c (For, Fand): 
--- a/src/unicode.c	Sun Sep 06 23:47:12 2009 +0100
+++ b/src/unicode.c	Fri Sep 11 17:54:07 2009 +0100
@@ -2221,7 +2221,7 @@
 
 	}
 
-      if (str->eof && ch)
+      if (str->eof && counter)
         {
           switch (type)
             {
@@ -2277,6 +2277,7 @@
               break;
             }
           ch = 0;
+          counter = 0;
         }
 
       data->counter = counter;
--- a/tests/ChangeLog	Sun Sep 06 23:47:12 2009 +0100
+++ b/tests/ChangeLog	Fri Sep 11 17:54:07 2009 +0100
@@ -1,3 +1,8 @@
+2009-09-11  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* automated/mule-tests.el (featurep): 
+	Check that a Unicode bug with very short inputs has been fixed.
+
 2009-09-02  Jerry James  <james@xemacs.org>
 
 	* reproduce-crashes.el (12): New bug.
--- a/tests/automated/mule-tests.el	Sun Sep 06 23:47:12 2009 +0100
+++ b/tests/automated/mule-tests.el	Fri Sep 11 17:54:07 2009 +0100
@@ -757,4 +757,11 @@
      do (unless (get-range-table i exceptions)
           (read (format (if (> i #xFFFF) #r"?\U%08X" #r"?\u%04X") i)))
      finally return t))
+  (loop
+    for i from #x00 to #xff
+    do (Assert
+        (= 1 (length (decode-coding-string (format "%c" i) 'utf-8-unix)))
+        (format 
+         "checking Unicode coding systems behave well with short input, %02X"
+         i)))
   )