handle incomplete sequences as if they were invalid
2009-10-15 Paolo Bonzini <bonzini@gnu.org> WANG Yunfeng <uhuruh@gmail.com> * sed/execute.c (str_append, str_append_modified): Handle incomplete sequences as if they were invalid.
This commit is contained in:
1 parent
db462e5466
commit
20f68fb1ab
3 files changed
+12
-4
No files matched your search
@@ -1,3 +1,9 @@
|
||||
2009-10-15 Paolo Bonzini <bonzini@gnu.org>
|
||||
WANG Yunfeng <uhuruh@gmail.com>
|
||||
|
||||
* sed/execute.c (str_append, str_append_modified): Handle incomplete
|
||||
sequences as if they were invalid.
|
||||
|
||||
2009-10-14 Paolo Bonzini <bonzini@gnu.org>
|
||||
|
||||
* po/sed.pot: Update.
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
Sed 4.2.2
|
||||
|
||||
* -u also does unbuffered input
|
||||
* fix endless loop on incomplete multibyte sequences
|
||||
|
||||
* -u also does unbuffered input, rather than unbuffered output only
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
Sed 4.2.1
|
||||
|
||||
+3
-3
@@ -254,8 +254,8 @@ str_append(to, string, length)
|
||||
{
|
||||
size_t n = MBRLEN (string, length, &to->mbstate);
|
||||
|
||||
/* An invalid sequence is treated like a singlebyte character. */
|
||||
if (n == (size_t) -1)
|
||||
/* An invalid or imcomplete sequence is treated like a singlebyte character. */
|
||||
if (n == (size_t) -1 || n == (size_t) -2)
|
||||
{
|
||||
memset (&to->mbstate, 0, sizeof (to->mbstate));
|
||||
n = 1;
|
||||
@@ -341,7 +341,7 @@ str_append_modified(to, string, length, type)
|
||||
/* Copy the new wide character to the end of the string. */
|
||||
n = WCRTOMB (to->active + to->length, wc, &to->mbstate);
|
||||
to->length += n;
|
||||
if (n == -1)
|
||||
if (n == -1 || n == -2)
|
||||
{
|
||||
fprintf (stderr, "Case conversion produced an invalid character!");
|
||||
abort ();
|
||||
|
||||
Reference in new issue
Block a user