This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug locale/20568] Segfault with wide characters and setlocale/fgetwc/UTF-8
- From: "schwab at linux-m68k dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Tue, 14 May 2019 15:32:00 +0000
- Subject: [Bug locale/20568] Segfault with wide characters and setlocale/fgetwc/UTF-8
- Auto-submitted: auto-generated
- References: <bug-20568-131@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=20568
--- Comment #9 from Andreas Schwab <schwab@linux-m68k.org> ---
That should fix it:
diff --git a/libio/wfileops.c b/libio/wfileops.c
index 5bc785b2b6..b30ef81813 100644
--- a/libio/wfileops.c
+++ b/libio/wfileops.c
@@ -508,11 +508,11 @@ _IO_wfile_sync (FILE *fp)
generate the wide characters up to the current reading
position. */
int nread;
-
+ size_t wnread = fp->_wide_data->_IO_read_ptr -
fp->_wide_data->_IO_read_base;
fp->_wide_data->_IO_state = fp->_wide_data->_IO_last_state;
nread = (*cv->__codecvt_do_length) (cv, &fp->_wide_data->_IO_state,
fp->_IO_read_base,
- fp->_IO_read_end, delta);
+ fp->_IO_read_end, wnread);
fp->_IO_read_ptr = fp->_IO_read_base + nread;
delta = -(fp->_IO_read_end - fp->_IO_read_base - nread);
}
--
You are receiving this mail because:
You are on the CC list for the bug.