Skip to content

Commit

Permalink
Handle mblen return code when n is zero.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ondřej Bílka committed Apr 3, 2015
1 parent 37d60d9 commit 9781a37
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
10 changes: 5 additions & 5 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions wcsmbs/mbrtoc16.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions wcsmbs/mbrtowc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9781a37

Please sign in to comment.