diff options
author | Siddhesh Poyarekar <siddhesh@redhat.com> | 2014-02-05 12:49:00 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@redhat.com> | 2014-02-05 12:49:00 +0530 |
commit | df675f9933c5d5461cea9224ed43beddef1a7b3a (patch) | |
tree | 2a8dea7fe4b18c231b834b2c87356cb16cfeb07d /nptl/tst-tsd5.c | |
parent | 68159946307adfc95a6e99d1c4af5c3de0c030f9 (diff) | |
download | glibc-df675f9933c5d5461cea9224ed43beddef1a7b3a.tar.gz glibc-df675f9933c5d5461cea9224ed43beddef1a7b3a.tar.xz glibc-df675f9933c5d5461cea9224ed43beddef1a7b3a.zip |
Fix infinite loop in ftell when writing wide char data (BZ #16398)
ftell tries to avoid flushing the buffer when it is in write mode by converting the wide char data and placing it into the binary buffer. If the output buffer space is full and there is data to write, the code reverts to flushing the buffer. This breaks when there is space in the buffer but it is not enough to convert the next character in the wide data buffer, due to which __codecvt_do_out returns a __codecvt_partial status. In this case, ftell keeps running in an infinite loop. The fix here is to detect the __codecvt_partial status in addition to checking if the buffer is full. I have also added a test case that demonstrates the infinite loop.
Diffstat (limited to 'nptl/tst-tsd5.c')
0 files changed, 0 insertions, 0 deletions