https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86419

--- Comment #5 from Dimitrij Mijoski <dmjpp at hotmail dot com> ---
I think I found where the bug lies. It lies in 

1. line 557 of the file c++11/codecvt.cc
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/src/c%2B%2B11/codecvt.cc;h=0311b15177d0439757e0347f7934b5a09b78f8e3;hb=HEAD#l557
.

  The return of the function utf16_in() should be:

      return from.size() ? codecvt_base::partial : codecvt_base::ok;

  The bug is triggered because the loop exists because t.size() is zero.
from.size() should be checked.

2. line 579 of the same file
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/src/c%2B%2B11/codecvt.cc;h=0311b15177d0439757e0347f7934b5a09b78f8e3;hb=HEAD#l579

 578             if (from.size() < 2)
 579               return codecvt_base::ok; // stop converting at this point

Should be

 578             if (from.size() < 2)
 579               return codecvt_base::partial; // stop converting at this
point

Reply via email to