https://llvm.org/bugs/show_bug.cgi?id=23650

            Bug ID: 23650
           Summary: raw_ostream calls memcpy() with NULL destination in
                    unbuffered mode
           Product: libraries
           Version: 3.6
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Support Libraries
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Using LLVM 3.6 and compiling with GCC 5.1 with UndefinedBehaviorSanitizer
enabled, this program:

#include <llvm/Support/raw_ostream.h>

int main()
{
    llvm::errs().SetUnbuffered();
    llvm::errs() << "";
}

produces

/usr/include/llvm/Support/raw_ostream.h:171:40: runtime error: null pointer
passed as argument 1, which is declared to never be null

The problematic place is here:
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?view=markup#l168
 In unbuffered mode, OutBufCur is a null pointer, but when Size == 0, the code
still tries to call memcpy() with it.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to