]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Avoid an abort() when the source file contains out-of-range Unicode characters.
authorBruno Haible <bruno@clisp.org>
Thu, 11 Sep 2003 16:40:32 +0000 (16:40 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:10:58 +0000 (12:10 +0200)
gettext-tools/src/ChangeLog
gettext-tools/src/po-lex.c

index a8787dcd2b567b33424ca8b3a7a1714872a2c043..150aacd4282839975f9882b5cd1110b6b56b2a3d 100644 (file)
@@ -1,3 +1,8 @@
+2003-09-11  Bruno Haible  <bruno@clisp.org>
+
+       * po-lex.c (mbfile_getc): Ignore the return value of u8_mbtouc().
+       Reported by Jochen Hein <jochen@jochen.org>.
+
 2003-09-09  Bruno Haible  <bruno@clisp.org>
 
        * read-properties.c (phase4_getuc): Cast line_number to 'unsigned long'
index fa916b8c73e41448d918e93f743fa3b3622d129d..c0b7df2e1f4ebda8b632959782476d686c074295 100644 (file)
@@ -511,8 +511,11 @@ incomplete multibyte sequence at end of line"));
                abort ();
              /* Convert it from UTF-8 to UCS-4.  */
              mbc->uc_valid = true;
-             if (u8_mbtouc (&mbc->uc, scratchbuf, outbytes) != outbytes)
-               abort ();
+             /* We ignore the return value of u8_mbtouc(): Usually it returns
+                outbytes, but if scratchbuf contains an out-of-range Unicode
+                character (> 0x10ffff), it can also return 1 and set mbc->uc
+                to 0xfffd.  This is precisely what we need.  */
+             u8_mbtouc (&mbc->uc, scratchbuf, outbytes);
              break;
            }
        }