From abe6b5a3e2c500b9f3dc15924281eee837cde789 Mon Sep 17 00:00:00 2001
From: Corinna Vinschen <corinna@vinschen.de>
Date: Tue, 22 Sep 2009 09:44:32 +0000
Subject: [PATCH] 	* strfuncs.cc (sys_cp_mbstowcs): Reset shift state
 after handling 	invalid multibyte sequence.

---
 winsup/cygwin/ChangeLog   | 5 +++++
 winsup/cygwin/strfuncs.cc | 1 +
 2 files changed, 6 insertions(+)

diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index d3d921426..ad149c8c5 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-22  Corinna Vinschen  <corinna@vinschen.de>
+
+	* strfuncs.cc (sys_cp_mbstowcs): Reset shift state after handling
+	invalid multibyte sequence.
+
 2009-09-22  Corinna Vinschen  <corinna@vinschen.de>
 
 	* path.cc (symlink_worker): Rework error handling to generate Linux
diff --git a/winsup/cygwin/strfuncs.cc b/winsup/cygwin/strfuncs.cc
index e16d94d86..88bbf767c 100644
--- a/winsup/cygwin/strfuncs.cc
+++ b/winsup/cygwin/strfuncs.cc
@@ -600,6 +600,7 @@ sys_cp_mbstowcs (mbtowc_p f_mbtowc, char *charset, wchar_t *dst, size_t dlen,
 	     decoding errors, seems like the best we can do. */
 	  if (dst)
 	    *ptr = L'\xdc80' | *pmbs;
+	  memset (&ps, 0, sizeof ps);
 	  bytes = 1;
 	}