Handle mblen return code when n is zero.

This commit is contained in:
Ondřej Bílka 2015-04-03 15:46:29 +02:00
parent 37d60d970c
commit 9781a37002
4 changed files with 17 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2015-04-03 Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>
[BZ #17596]
* wcsmbs/mbrtowc.c (__mbrtowc): Add check for n=0.
* wcsmbs/mbrtoc16.c (mbrtoc16): Likewise.
2015-04-02 Florian Weimer <fweimer@redhat.com>
* include/libc-internal.h (libc_max_align_t): Define.

10
NEWS
View File

@ -11,11 +11,11 @@ Version 2.22
4719, 13064, 14094, 14841, 14906, 15319, 15467, 15790, 15969, 16351,
16512, 16560, 16783, 16850, 17090, 17195, 17269, 17523, 17542, 17569,
17588, 17620, 17621, 17628, 17631, 17711, 17776, 17779, 17792, 17836,
17912, 17916, 17932, 17944, 17949, 17964, 17965, 17967, 17969, 17978,
17987, 17991, 17996, 17998, 17999, 18019, 18020, 18029, 18030, 18032,
18036, 18038, 18039, 18042, 18043, 18046, 18047, 18068, 18080, 18093,
18100, 18104, 18110, 18111, 18128, 18138, 18185.
17588, 17596, 17620, 17621, 17628, 17631, 17711, 17776, 17779, 17792,
17836, 17912, 17916, 17932, 17944, 17949, 17964, 17965, 17967, 17969,
17978, 17987, 17991, 17996, 17998, 17999, 18019, 18020, 18029, 18030,
18032, 18036, 18038, 18039, 18042, 18043, 18046, 18047, 18068, 18080,
18093, 18100, 18104, 18110, 18111, 18128, 18138, 18185.
* A powerpc and powerpc64 optimization for TLS, similar to TLS descriptors
for LD and GD on x86 and x86-64, has been implemented. You will need

View File

@ -77,6 +77,9 @@ mbrtoc16 (char16_t *pc16, const char *s, size_t n, mbstate_t *ps)
n = 1;
}
if (n == 0)
return (size_t) -2;
/* Tell where we want the result. */
data.__outbuf = outbuf;
data.__outbufend = outbuf + sizeof (wchar_t);

View File

@ -59,6 +59,9 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
n = 1;
}
if (n == 0)
return (size_t) -2;
/* Tell where we want the result. */
data.__outbuf = outbuf;
data.__outbufend = outbuf + sizeof (wchar_t);