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

Side by Side Diff: test/cctest/test-conversions.cc

Issue 998213002: add 0 length guard in IsNonArrayIndexInteger (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: test Created 5 years, 9 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
« no previous file with comments | « src/conversions.cc ('k') | 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 static void CheckNonArrayIndex(bool expected, const char* chars) { 367 static void CheckNonArrayIndex(bool expected, const char* chars) {
368 auto isolate = CcTest::i_isolate(); 368 auto isolate = CcTest::i_isolate();
369 auto string = isolate->factory()->NewStringFromAsciiChecked(chars); 369 auto string = isolate->factory()->NewStringFromAsciiChecked(chars);
370 CHECK_EQ(expected, IsNonArrayIndexInteger(*string)); 370 CHECK_EQ(expected, IsNonArrayIndexInteger(*string));
371 } 371 }
372 372
373 373
374 TEST(NonArrayIndexParsing) { 374 TEST(NonArrayIndexParsing) {
375 auto isolate = CcTest::i_isolate(); 375 auto isolate = CcTest::i_isolate();
376 HandleScope scope(isolate); 376 HandleScope scope(isolate);
377 CheckNonArrayIndex(false, "");
377 CheckNonArrayIndex(false, "-"); 378 CheckNonArrayIndex(false, "-");
378 CheckNonArrayIndex(false, "0"); 379 CheckNonArrayIndex(false, "0");
379 CheckNonArrayIndex(false, "01"); 380 CheckNonArrayIndex(false, "01");
380 CheckNonArrayIndex(false, "-01"); 381 CheckNonArrayIndex(false, "-01");
381 CheckNonArrayIndex(false, "4294967295"); 382 CheckNonArrayIndex(false, "4294967295");
382 CheckNonArrayIndex(false, "429496.7295"); 383 CheckNonArrayIndex(false, "429496.7295");
383 CheckNonArrayIndex(false, "43s3"); 384 CheckNonArrayIndex(false, "43s3");
384 CheckNonArrayIndex(true, "-0"); 385 CheckNonArrayIndex(true, "-0");
385 CheckNonArrayIndex(true, "-1"); 386 CheckNonArrayIndex(true, "-1");
386 CheckNonArrayIndex(true, "4294967296"); 387 CheckNonArrayIndex(true, "4294967296");
(...skipping 22 matching lines...) Expand all
409 "429496729642949672964294967296429496729642949672964294967296" 410 "429496729642949672964294967296429496729642949672964294967296"
410 "429496729642949672964294967296429496729642949672964294967296" 411 "429496729642949672964294967296429496729642949672964294967296"
411 "429496729642949672964294967296429496729642949672964294967296" 412 "429496729642949672964294967296429496729642949672964294967296"
412 "429496729642949672964294967296429496729642949672964294967296" 413 "429496729642949672964294967296429496729642949672964294967296"
413 "429496729642949672964294967296429496729642949672964294967296" 414 "429496729642949672964294967296429496729642949672964294967296"
414 "429496729642949672964294967296429496729642949672964294967296" 415 "429496729642949672964294967296429496729642949672964294967296"
415 "429496729642949672964294967296429496729642949672964294967296" 416 "429496729642949672964294967296429496729642949672964294967296"
416 "429496729642949672964294967296429496729642949672964294967296" 417 "429496729642949672964294967296429496729642949672964294967296"
417 "429496729642949672964294967296429496729642949672964294967296"); 418 "429496729642949672964294967296429496729642949672964294967296");
418 } 419 }
OLDNEW
« no previous file with comments | « src/conversions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698