Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Unified Diff: src/runtime.cc

Issue 12326120: Fix overflow in WriteQuoteJsonString and SlowQuoteJsonString (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-latin-1.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 95872a18aaaa8c41b6320a97f298a84eb3d9feb1..4483f6954e661ec589aa53f3975ce9e65eba7459 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -5248,7 +5248,7 @@ static MaybeObject* SlowQuoteJsonString(Isolate* isolate,
int quoted_length = kSpaceForQuotes;
while (read_cursor < end) {
Char c = *(read_cursor++);
- if (sizeof(Char) > 1u && static_cast<unsigned>(c) >= kQuoteTableLength) {
+ if (static_cast<unsigned>(c) >= kQuoteTableLength) {
quoted_length++;
} else {
quoted_length += JsonQuoteLengths[static_cast<unsigned>(c)];
@@ -5270,7 +5270,7 @@ static MaybeObject* SlowQuoteJsonString(Isolate* isolate,
read_cursor = characters.start();
while (read_cursor < end) {
Char c = *(read_cursor++);
- if (sizeof(Char) > 1u && static_cast<unsigned>(c) >= kQuoteTableLength) {
+ if (static_cast<unsigned>(c) >= kQuoteTableLength) {
*(write_cursor++) = c;
} else {
int len = JsonQuoteLengths[static_cast<unsigned>(c)];
@@ -5298,8 +5298,7 @@ static inline SinkChar* WriteQuoteJsonString(
*(write_cursor++) = '"';
while (read_cursor < end) {
SourceChar c = *(read_cursor++);
- if (sizeof(SourceChar) > 1u &&
- static_cast<unsigned>(c) >= kQuoteTableLength) {
+ if (static_cast<unsigned>(c) >= kQuoteTableLength) {
*(write_cursor++) = static_cast<SinkChar>(c);
} else {
int len = JsonQuoteLengths[static_cast<unsigned>(c)];
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-latin-1.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698