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

Side by Side Diff: src/scanner.cc

Issue 731953003: Fix one more missing c0_ < 0 check in scanner (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-433766.js » ('j') | 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Features shared by parsing and pre-parsing scanners. 5 // Features shared by parsing and pre-parsing scanners.
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 10
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 Advance(); 305 Advance();
306 } 306 }
307 307
308 return Token::WHITESPACE; 308 return Token::WHITESPACE;
309 } 309 }
310 310
311 311
312 void Scanner::TryToParseSourceURLComment() { 312 void Scanner::TryToParseSourceURLComment() {
313 // Magic comments are of the form: //[#@]\s<name>=\s*<value>\s*.* and this 313 // Magic comments are of the form: //[#@]\s<name>=\s*<value>\s*.* and this
314 // function will just return if it cannot parse a magic comment. 314 // function will just return if it cannot parse a magic comment.
315 if (!unicode_cache_->IsWhiteSpace(c0_)) 315 if (c0_ < 0 || !unicode_cache_->IsWhiteSpace(c0_)) return;
316 return;
317 Advance(); 316 Advance();
318 LiteralBuffer name; 317 LiteralBuffer name;
319 while (c0_ >= 0 && !unicode_cache_->IsWhiteSpaceOrLineTerminator(c0_) && 318 while (c0_ >= 0 && !unicode_cache_->IsWhiteSpaceOrLineTerminator(c0_) &&
320 c0_ != '=') { 319 c0_ != '=') {
321 name.AddChar(c0_); 320 name.AddChar(c0_);
322 Advance(); 321 Advance();
323 } 322 }
324 if (!name.is_one_byte()) return; 323 if (!name.is_one_byte()) return;
325 Vector<const uint8_t> name_literal = name.one_byte_literal(); 324 Vector<const uint8_t> name_literal = name.one_byte_literal();
326 LiteralBuffer* value; 325 LiteralBuffer* value;
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 } 1403 }
1405 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); 1404 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u));
1406 } 1405 }
1407 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); 1406 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f));
1408 1407
1409 backing_store_.AddBlock(bytes); 1408 backing_store_.AddBlock(bytes);
1410 return backing_store_.EndSequence().start(); 1409 return backing_store_.EndSequence().start();
1411 } 1410 }
1412 1411
1413 } } // namespace v8::internal 1412 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-433766.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698