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

Side by Side Diff: src/json-parser.h

Issue 10977009: Fix off-by-one error introduced in r12598. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 uc32 c0 = c0_; 573 uc32 c0 = c0_;
574 do { 574 do {
575 if (c0 == '\\') { 575 if (c0 == '\\') {
576 return SlowScanJsonString<SeqAsciiString, char>(source_, 576 return SlowScanJsonString<SeqAsciiString, char>(source_,
577 position_, 577 position_,
578 position); 578 position);
579 } 579 }
580 if (c0_ < 0x20) return Handle<String>::null(); 580 if (c0_ < 0x20) return Handle<String>::null();
581 running_hash = StringHasher::AddCharacterCore(running_hash, c0); 581 running_hash = StringHasher::AddCharacterCore(running_hash, c0);
582 position++; 582 position++;
583 if (position > source_length_) return Handle<String>::null(); 583 if (position >= source_length_) return Handle<String>::null();
584 c0 = seq_source_->SeqAsciiStringGet(position); 584 c0 = seq_source_->SeqAsciiStringGet(position);
585 } while (c0 != '"'); 585 } while (c0 != '"');
586 int length = position - position_; 586 int length = position - position_;
587 uint32_t hash = (length <= String::kMaxHashCalcLength) 587 uint32_t hash = (length <= String::kMaxHashCalcLength)
588 ? StringHasher::GetHashCore(running_hash) : length; 588 ? StringHasher::GetHashCore(running_hash) : length;
589 Vector<const char> string_vector( 589 Vector<const char> string_vector(
590 seq_source_->GetChars() + position_, length); 590 seq_source_->GetChars() + position_, length);
591 SymbolTable* symbol_table = isolate()->heap()->symbol_table(); 591 SymbolTable* symbol_table = isolate()->heap()->symbol_table();
592 uint32_t capacity = symbol_table->Capacity(); 592 uint32_t capacity = symbol_table->Capacity();
593 uint32_t index = SymbolTable::FirstProbe(hash, capacity); 593 uint32_t index = SymbolTable::FirstProbe(hash, capacity);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 } 642 }
643 ASSERT_EQ('"', c0_); 643 ASSERT_EQ('"', c0_);
644 // Advance past the last '"'. 644 // Advance past the last '"'.
645 AdvanceSkipWhitespace(); 645 AdvanceSkipWhitespace();
646 return result; 646 return result;
647 } 647 }
648 648
649 } } // namespace v8::internal 649 } } // namespace v8::internal
650 650
651 #endif // V8_JSON_PARSER_H_ 651 #endif // V8_JSON_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698