Use a fixed-size buffer for log messages
libc++'s implementation of ostrstream seems to have incorrect range-checking and does some out-of-bounds reads and writes whenever a resize is needed, which results in crashes on 10.7 (but not 10.9 for unknown reasons).
This commit is contained in:
parent
f886237623
commit
23a21b33b1
2 changed files with 4 additions and 1 deletions
|
@ -84,7 +84,9 @@ decltype(LogSink::messages) LogSink::GetMessages() const {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Message::Message(const char *section, Severity severity, const char *file, const char *func, int line) {
|
Message::Message(const char *section, Severity severity, const char *file, const char *func, int line)
|
||||||
|
: msg(buffer, sizeof buffer)
|
||||||
|
{
|
||||||
sm.section = section;
|
sm.section = section;
|
||||||
sm.severity = severity;
|
sm.severity = severity;
|
||||||
sm.file = file;
|
sm.file = file;
|
||||||
|
|
|
@ -139,6 +139,7 @@ public:
|
||||||
class Message {
|
class Message {
|
||||||
std::ostrstream msg;
|
std::ostrstream msg;
|
||||||
SinkMessage sm;
|
SinkMessage sm;
|
||||||
|
char buffer[2048];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Message(const char *section, Severity severity, const char *file, const char *func, int line);
|
Message(const char *section, Severity severity, const char *file, const char *func, int line);
|
||||||
|
|
Loading…
Reference in a new issue