]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Handle lone high surrogates gracefully.
authorBruno Haible <bruno@clisp.org>
Sun, 3 Aug 2008 20:00:25 +0000 (20:00 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:15:45 +0000 (12:15 +0200)
gettext-tools/src/ChangeLog
gettext-tools/src/x-python.c

index 9e0d17243fd38157a5b7ec485609b8a3e749fe56..c7e1aef1e723f806f98bbf52af20c1fe315068b7 100644 (file)
@@ -1,3 +1,10 @@
+2008-08-03  Bruno Haible  <bruno@clisp.org>
+
+       * x-python.c (mixed_string_buffer_append): Replace a lone high
+       surrogate with U+FFFD.
+       Reported by Yann <asterix@lagaule.org>
+       via Santiago Vila <sanvila@unex.es>.
+
 2008-07-19  Bruno Haible  <bruno@clisp.org>
 
        * gnu/gettext/GetURL.java: Don't output anything to standard error.
index e6dcc3190ce307535377c9cf7611d661956a838f..e05aca4166369d39883d5883a2161827603b59e0 100644 (file)
@@ -930,6 +930,11 @@ mixed_string_buffer_append (struct mixed_string_buffer *bp, int c)
 
          if (c >= UNICODE (0xd800) && c < UNICODE (0xdc00))
            bp->utf16_surr = UNICODE_VALUE (c);
+         else if (c >= UNICODE (0xdc00) && c < UNICODE (0xe000))
+           {
+             /* A half surrogate is invalid, therefore use U+FFFD instead.  */
+             mixed_string_buffer_append_unicode (bp, 0xfffd);
+           }
          else
            mixed_string_buffer_append_unicode (bp, UNICODE_VALUE (c));
        }