[LLVMbugs] [Bug 18482] New: Bad alignment in convertUTF16ToUTF8String

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jan 14 19:29:50 PST 2014


            Bug ID: 18482
           Summary: Bad alignment in convertUTF16ToUTF8String
           Product: libraries
           Version: trunk
          Hardware: Sun
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Support Libraries
          Assignee: unassignedbugs at nondot.org
          Reporter: stoklund at 2pi.dk
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

lib/Support/ConvertUTFWrapper.cpp contains this code:

bool convertUTF16ToUTF8String(ArrayRef<char> SrcBytes, std::string &Out) {
  const UTF16 *Src = reinterpret_cast<const UTF16 *>(SrcBytes.begin());
  const UTF16 *SrcEnd = reinterpret_cast<const UTF16 *>(SrcBytes.end());

The UTF16 type is normally 2-byte aligned, and there is no guarantee that the
ArrayRef points to aligned bytes.

This crashes the unit test ConvertUTFTest.ConvertUTF16LittleEndianToUTF8String

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/20140115/99b6f96d/attachment.html>

More information about the llvm-bugs mailing list