[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6908] Fix crashes in mbrtowc on MS-Windows.
From: |
Eli Zaretskii |
Subject: |
[6908] Fix crashes in mbrtowc on MS-Windows. |
Date: |
Fri, 01 Jan 2016 18:58:37 +0000 |
Revision: 6908
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6908
Author: eliz
Date: 2016-01-01 18:58:36 +0000 (Fri, 01 Jan 2016)
Log Message:
-----------
Fix crashes in mbrtowc on MS-Windows.
Modified Paths:
--------------
trunk/ChangeLog
trunk/tp/Texinfo/Convert/XSParagraph/xspara.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2016-01-01 18:42:32 UTC (rev 6907)
+++ trunk/ChangeLog 2016-01-01 18:58:36 UTC (rev 6908)
@@ -1,3 +1,9 @@
+2016-01-01 Eli Zaretskii <address@hidden>
+
+ * tp/Texinfo/Convert/XSParagraph/xspara.c (mbrtowc): Don't try to
+ convert more bytes than a single UTF-8 sequence at the beginning
+ of the argument string: otherwise MultiByteToWideChar fails.
+
2016-01-01 Karl Berry <address@hidden>
* makeinfo/README,
Modified: trunk/tp/Texinfo/Convert/XSParagraph/xspara.c
===================================================================
--- trunk/tp/Texinfo/Convert/XSParagraph/xspara.c 2016-01-01 18:42:32 UTC
(rev 6907)
+++ trunk/tp/Texinfo/Convert/XSParagraph/xspara.c 2016-01-01 18:58:36 UTC
(rev 6908)
@@ -126,13 +126,15 @@
mbrtowc (wchar_t * __restrict__ pwc, const char * __restrict__ mbs, size_t n,
mbstate_t * __restrict__ ps)
{
+ int len = mbrlen (mbs, n, ps);
+
if (mbs == NULL)
return 0;
else
{
wchar_t wc[2];
size_t n_utf16 = MultiByteToWideChar (CP_UTF8, MB_ERR_INVALID_CHARS,
- mbs, n, wc, 2);
+ mbs, len, wc, 2);
if (n_utf16 == 0)
{
errno = EILSEQ;
@@ -153,7 +155,7 @@
if (pwc != NULL)
*pwc = wc[0];
- return mbrlen (mbs, n, ps);
+ return len;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6908] Fix crashes in mbrtowc on MS-Windows.,
Eli Zaretskii <=