Index: src/log.cc |
diff --git a/src/log.cc b/src/log.cc |
index b9eb577b2054f5c5e84d7b02f91425ff06522f65..ea69fb4bee3e71cecb6ae6a38f8dba69445b3657 100644 |
--- a/src/log.cc |
+++ b/src/log.cc |
@@ -123,8 +123,9 @@ class CodeEventLogger::NameBuffer { |
} |
void AppendInt(int n) { |
- Vector<char> buffer(utf8_buffer_ + utf8_pos_, |
- kUtf8BufferSize - utf8_pos_); |
+ int space = kUtf8BufferSize - utf8_pos_; |
+ if (space <= 0) return; |
+ Vector<char> buffer(utf8_buffer_ + utf8_pos_, space); |
int size = SNPrintF(buffer, "%d", n); |
if (size > 0 && utf8_pos_ + size <= kUtf8BufferSize) { |
utf8_pos_ += size; |
@@ -132,8 +133,9 @@ class CodeEventLogger::NameBuffer { |
} |
void AppendHex(uint32_t n) { |
- Vector<char> buffer(utf8_buffer_ + utf8_pos_, |
- kUtf8BufferSize - utf8_pos_); |
+ int space = kUtf8BufferSize - utf8_pos_; |
+ if (space <= 0) return; |
+ Vector<char> buffer(utf8_buffer_ + utf8_pos_, space); |
int size = SNPrintF(buffer, "%x", n); |
if (size > 0 && utf8_pos_ + size <= kUtf8BufferSize) { |
utf8_pos_ += size; |
@@ -145,7 +147,7 @@ class CodeEventLogger::NameBuffer { |
private: |
static const int kUtf8BufferSize = 512; |
- static const int kUtf16BufferSize = 128; |
+ static const int kUtf16BufferSize = kUtf8BufferSize; |
int utf8_pos_; |
char utf8_buffer_[kUtf8BufferSize]; |