of invalid multibyte sequences.
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>.
+ * po-lex.c (mbfile_getc): Handle unexpected return value of
+ u8_mbtouc(). Reported by Jochen Hein <jochen@jochen.org>.
2003-09-09 Bruno Haible <bruno@clisp.org>
if (outbytes == 0)
abort ();
/* Convert it from UTF-8 to UCS-4. */
+ if (u8_mbtouc (&mbc->uc, scratchbuf, outbytes) < outbytes)
+ {
+ /* scratchbuf contains an out-of-range Unicode character
+ (> 0x10ffff). */
+ if (signal_eilseq)
+ po_gram_error (_("invalid multibyte sequence"));
+ mbc->uc_valid = false;
+ break;
+ }
mbc->uc_valid = true;
- /* 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;
}
}
tmpfiles="$tmpfiles mf-test14.mo"
: ${MSGFMT=msgfmt}
-${MSGFMT} mf-test14.po -o mf-test14.mo
-test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+${MSGFMT} mf-test14.po -o mf-test14.mo 2>/dev/null
+# Exit code must be 1.
+# If the invalid sequence didn't get noticed, it would be 0.
+# If it produced a core dump, it would be 134 (= 128 + SIGABRT).
+test $? = 1
+result=$?
rm -fr $tmpfiles