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

Side by Side Diff: src/runtime.cc

Issue 22927014: Fix null handle deref in InternalDateFormat (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 13631 matching lines...) Expand 10 before | Expand all | Expand 10 after
13642 13642
13643 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalDateFormat) { 13643 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalDateFormat) {
13644 HandleScope scope(isolate); 13644 HandleScope scope(isolate);
13645 13645
13646 ASSERT(args.length() == 2); 13646 ASSERT(args.length() == 2);
13647 13647
13648 CONVERT_ARG_HANDLE_CHECKED(JSObject, date_format_holder, 0); 13648 CONVERT_ARG_HANDLE_CHECKED(JSObject, date_format_holder, 0);
13649 CONVERT_ARG_HANDLE_CHECKED(JSDate, date, 1); 13649 CONVERT_ARG_HANDLE_CHECKED(JSDate, date, 1);
13650 13650
13651 bool has_pending_exception = false; 13651 bool has_pending_exception = false;
13652 double millis = Execution::ToNumber(date, &has_pending_exception)->Number(); 13652 Handle<Object> value = Execution::ToNumber(date, &has_pending_exception);
13653 if (has_pending_exception) { 13653 if (has_pending_exception) {
13654 ASSERT(isolate->has_pending_exception()); 13654 ASSERT(isolate->has_pending_exception());
13655 return Failure::Exception(); 13655 return Failure::Exception();
13656 } 13656 }
13657 13657
13658 icu::SimpleDateFormat* date_format = 13658 icu::SimpleDateFormat* date_format =
13659 DateFormat::UnpackDateFormat(isolate, date_format_holder); 13659 DateFormat::UnpackDateFormat(isolate, date_format_holder);
13660 if (!date_format) return isolate->ThrowIllegalOperation(); 13660 if (!date_format) return isolate->ThrowIllegalOperation();
13661 13661
13662 icu::UnicodeString result; 13662 icu::UnicodeString result;
13663 date_format->format(millis, result); 13663 date_format->format(value->Number(), result);
13664 13664
13665 return *isolate->factory()->NewStringFromTwoByte( 13665 return *isolate->factory()->NewStringFromTwoByte(
13666 Vector<const uint16_t>( 13666 Vector<const uint16_t>(
13667 reinterpret_cast<const uint16_t*>(result.getBuffer()), 13667 reinterpret_cast<const uint16_t*>(result.getBuffer()),
13668 result.length())); 13668 result.length()));
13669 } 13669 }
13670 13670
13671 13671
13672 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalDateParse) { 13672 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalDateParse) {
13673 HandleScope scope(isolate); 13673 HandleScope scope(isolate);
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
14491 // Handle last resort GC and make sure to allow future allocations 14491 // Handle last resort GC and make sure to allow future allocations
14492 // to grow the heap without causing GCs (if possible). 14492 // to grow the heap without causing GCs (if possible).
14493 isolate->counters()->gc_last_resort_from_js()->Increment(); 14493 isolate->counters()->gc_last_resort_from_js()->Increment();
14494 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14494 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14495 "Runtime::PerformGC"); 14495 "Runtime::PerformGC");
14496 } 14496 }
14497 } 14497 }
14498 14498
14499 14499
14500 } } // namespace v8::internal 14500 } } // namespace v8::internal
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