From 1558ab4ce71d8db60e2897fc2ea8a963ded878dd Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Thu, 16 Sep 2010 19:20:51 +0000 Subject: [PATCH] gdb/ * charset.c (wchar_iterate) : Return any possibly converted characters. --- gdb/ChangeLog | 5 +++++ gdb/charset.c | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 85e69738b34..9d6b886ac25 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2010-09-16 Jan Kratochvil + + * charset.c (wchar_iterate) : Return any possibly converted + characters. + 2010-09-16 Phil Muldoon PR mi/11407 diff --git a/gdb/charset.c b/gdb/charset.c index 32742190865..90d5717b573 100644 --- a/gdb/charset.c +++ b/gdb/charset.c @@ -648,8 +648,13 @@ wchar_iterate (struct wchar_iterator *iter, switch (errno) { case EILSEQ: - /* Invalid input sequence. Skip it, and let the caller - know about it. */ + /* Invalid input sequence. We still might have converted a + character; if so, return it. */ + if (out_avail < out_request * sizeof (gdb_wchar_t)) + break; + + /* Otherwise skip the first invalid character, and let the + caller know about it. */ *out_result = wchar_iterate_invalid; *ptr = iter->input; *len = iter->width; -- 2.30.2