Commit 6cd62ed2 authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Unbork Windows 64 bit build and guard against overlong UTF-8

serializations.
Review URL: https://chromiumcodereview.appspot.com/9817005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11105 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 25f84a48
...@@ -3721,7 +3721,7 @@ static int RecursivelySerializeToUtf8(i::String* string, ...@@ -3721,7 +3721,7 @@ static int RecursivelySerializeToUtf8(i::String* string,
previous_character = character; previous_character = character;
} }
*last_character = previous_character; *last_character = previous_character;
return utf8_bytes + current - buffer; return static_cast<int>(utf8_bytes + current - buffer);
} }
case i::kSeqStringTag: { case i::kSeqStringTag: {
const uint16_t* data = const uint16_t* data =
...@@ -3734,7 +3734,7 @@ static int RecursivelySerializeToUtf8(i::String* string, ...@@ -3734,7 +3734,7 @@ static int RecursivelySerializeToUtf8(i::String* string,
previous_character = character; previous_character = character;
} }
*last_character = previous_character; *last_character = previous_character;
return utf8_bytes + current - buffer; return static_cast<int>(utf8_bytes + current - buffer);
} }
case i::kSlicedStringTag: { case i::kSlicedStringTag: {
i::SlicedString* slice = i::SlicedString::cast(string); i::SlicedString* slice = i::SlicedString::cast(string);
...@@ -3818,7 +3818,7 @@ int String::WriteUtf8(char* buffer, ...@@ -3818,7 +3818,7 @@ int String::WriteUtf8(char* buffer,
return len; return len;
} }
if (capacity == -1 || capacity >= string_length * 3) { if (capacity == -1 || capacity / 3 >= string_length) {
int32_t previous = unibrow::Utf16::kNoPreviousCharacter; int32_t previous = unibrow::Utf16::kNoPreviousCharacter;
const int kMaxRecursion = 100; const int kMaxRecursion = 100;
int utf8_bytes = int utf8_bytes =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment