On section 6.3.5 - "A Complete Multibyte Conversion Example" the example describe an algorithm to convert an NUL-terminated multibyte character string at into an equivalent wide character string. It does: 1. read from input file to temp buffer 2. convert characters in temp buffer 3. write to output file the converted characters 4. go to step one, but first copy incomplete sequence to start of temp buffer The pass four is implemented by a memmove(), taking an incomplete at the end of the buffer and repositioning it at the start of the buffer. ERROR: ------ The aforementioned memmove() has its parameters inverted, because it`s not putting the remaining characters in the beginning of the buffer. Instead of: memmove (inp, buffer, filled); It should obviously be: memmove (buffer, inp, filled);
Created attachment 3976 [details] proposed patch proposed fix
Commited on: http://repo.or.cz/w/glibc.git? a=commit;h=21e66bc528edcbe18d434eb33a601e0f796904c9
Fix is available from latest sources now.