[LLVMbugs] [Bug 15579] New: Incorrect handling of piped string containing 0xFF

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Mar 24 04:41:25 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=15579

            Bug ID: 15579
           Summary: Incorrect handling of piped string containing 0xFF
           Product: libc++
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: hhinnant at apple.com
          Reporter: sergiy.dubovik at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 10232
  --> http://llvm.org/bugs/attachment.cgi?id=10232&action=edit
300-utf8-ff.t File containing 0xFF

On Mac OS x 10.8.3, with latest XCode and command line tools.
--- main.cpp ----
#include <iostream>
#include <string>
#include <sstream>
#include <fstream>

using namespace std;

int main(int argc, char ** argv)
{
  ostringstream oss;
  oss << cin.rdbuf();
  string inputString = oss.str();
  cout << "size: " << inputString.size() << endl;
  return 0;
}

This is correct output:
> clang main.cpp -lstdc++
> ./a.out < 300-utf8-ff.t
Size: 3

This is incorrect output:
> clang main.cpp -lstdc++ -stdlib=libc++
> ./a.out < 300-utf8-ff.t
Size: 1


300-utf8-ff.t contains a\xFFb.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130324/496c1433/attachment.html>


More information about the llvm-bugs mailing list