summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/text/TextStream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/text/TextStream.cpp')
-rw-r--r--WebCore/platform/text/TextStream.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/WebCore/platform/text/TextStream.cpp b/WebCore/platform/text/TextStream.cpp
index 646de3f..1094fa4 100644
--- a/WebCore/platform/text/TextStream.cpp
+++ b/WebCore/platform/text/TextStream.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2008, 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,6 +29,8 @@
#include "PlatformString.h"
#include <wtf/StringExtras.h>
+using namespace std;
+
namespace WebCore {
static const size_t printBufferSize = 100; // large enough for any integer or floating point value in string format, including trailing null character
@@ -84,6 +86,8 @@ TextStream& TextStream::operator<<(const char* string)
{
size_t stringLength = strlen(string);
size_t textLength = m_text.size();
+ if (stringLength > numeric_limits<size_t>::max() - textLength)
+ CRASH();
m_text.grow(textLength + stringLength);
for (size_t i = 0; i < stringLength; ++i)
m_text[textLength + i] = string[i];