http://llvm.org/bugs/show_bug.cgi?id=22536
Bug ID: 22536 Summary: SetErrorStringWithVarArg needs to use vscprintf on Windows Product: lldb Version: unspecified Hardware: PC OS: Windows NT Status: NEW Severity: normal Priority: P Component: All Bugs Assignee: amcca...@google.com Reporter: ztur...@google.com CC: lldb-dev@cs.uiuc.edu Classification: Unclassified In Error::SetErrorStringWithVarArg(), lldb calls vsnprintf. To be standards conformant, the function must return "The number of characters that would have been written if n had been sufficiently large, not counting the terminating null character." (http://www.cplusplus.com/reference/cstdio/vsnprintf/). On Windows, apparently, "if the number of characters to write is greater than count, these functions return -1 indicating that output has been truncated." (https://msdn.microsoft.com/en-us/library/1kt27hek.aspx). This sometimes triggers a segfault in this function (Thanks to ki9a for finding this). It seems that on Windows we need to call _vscprintf (https://msdn.microsoft.com/en-us/library/w05tbk72.aspx) in order to determine the correct buffer size before calling vsnprintf. Not sure how to reproduce this in live code, but a test that calls SBError::SetExpressionErrorWithFormat() should be able to for this code path, and would also be a good test to have anyway. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ lldb-dev mailing list lldb-dev@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev