diff options
| author | sin | 2017-08-22 11:31:49 +0100 |
|---|---|---|
| committer | sin | 2017-08-22 11:38:36 +0100 |
| commit | 9730e9d297068f7555621891072360c58095efc8 (patch) | |
| tree | 8f7f8e4aeb8d1e5b4ef143f463f04516945dfb34 /include/poll.h | |
| parent | 2bc423c355a992fea2f95724235898218575c95e (diff) | |
Don't trap if an encoding error occurs in wcrtomb()
The POSIX definition of wcrtomb
(http://pubs.opengroup.org/onlinepubs/9699919799/functions/wcrtomb.html)
states:
"When wc is not a valid wide character, an encoding error shall occur.
In this case, the function shall store the value of the macro [EILSEQ]
in errno and shall return (size_t)-1; the conversion state shall be
undefined."
The fortify-headers implementation of wcrtomb interprets the result -1
as 18446744073709551615 bytes. Since this is the highest 64-bit number
possible, it is pretty safe to say this will always be larger than any
buffer provided to wcrtomb. Therefore, it traps.
Fixes bug https://bugs.alpinelinux.org/issues/7681.
Patch by A. Wilcox <AWilcox@Wilcox-Tech.com>
Diffstat (limited to 'include/poll.h')
0 files changed, 0 insertions, 0 deletions
