Index: src/scanner.h |
diff --git a/src/scanner.h b/src/scanner.h |
index d40c6266b729b7edc5a97b1e4057de42a93a0d04..7f35e719da783767d55c96ffe04d29d8b7bb12c3 100644 |
--- a/src/scanner.h |
+++ b/src/scanner.h |
@@ -219,6 +219,7 @@ class LiteralBuffer { |
*reinterpret_cast<uint16_t*>(&backing_store_[position_]) = |
unibrow::Utf16::LeadSurrogate(code_unit); |
position_ += kUC16Size; |
+ if (position_ >= backing_store_.length()) ExpandBuffer(); |
*reinterpret_cast<uint16_t*>(&backing_store_[position_]) = |
unibrow::Utf16::TrailSurrogate(code_unit); |
position_ += kUC16Size; |