On 03/24/2010 05:17 PM, Jim Meyering wrote:
Paolo Bonzini wrote:
From: Norihirio Tanaka<[email protected]>
* src/searchutils.c (is_mb_middle): When treating an invalid sequence
or a truncated multibyte character as a single byte character, reset
mbstate
---
src/searchutils.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/searchutils.c b/src/searchutils.c
index ef4fef3..960e3ba 100644
--- a/src/searchutils.c
+++ b/src/searchutils.c
@@ -131,6 +131,7 @@ is_mb_middle(const char **good, const char *buf, const char
*end)
/* An invalid sequence, or a truncated multibyte character.
We treat it as a single byte character. */
mbclen = 1;
+ memset(mbstate, 0, sizeof(mbstate_t));
}
p += mbclen;
}
Thank you for the patch.
Do either of you have a test case?
No, or I would have included it. But it matches what grep does in
general to handle this case.
Paolo