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

Side by Side Diff: src/api.cc

Issue 226133002: Compare external pixel data length against Smi::kMaxValue (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 | src/objects.h » ('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 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 3726 matching lines...) Expand 10 before | Expand all | Expand 10 after
3737 } 3737 }
3738 3738
3739 } // namespace 3739 } // namespace
3740 3740
3741 3741
3742 void v8::Object::SetIndexedPropertiesToPixelData(uint8_t* data, int length) { 3742 void v8::Object::SetIndexedPropertiesToPixelData(uint8_t* data, int length) {
3743 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3743 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3744 ON_BAILOUT(isolate, "v8::SetElementsToPixelData()", return); 3744 ON_BAILOUT(isolate, "v8::SetElementsToPixelData()", return);
3745 ENTER_V8(isolate); 3745 ENTER_V8(isolate);
3746 i::HandleScope scope(isolate); 3746 i::HandleScope scope(isolate);
3747 if (!Utils::ApiCheck(length >= 0 && 3747 if (!Utils::ApiCheck(length >= 0 && length <= i::Smi::kMaxValue,
3748 length <= i::ExternalUint8ClampedArray::kMaxLength,
3749 "v8::Object::SetIndexedPropertiesToPixelData()", 3748 "v8::Object::SetIndexedPropertiesToPixelData()",
3750 "length exceeds max acceptable value")) { 3749 "length exceeds max acceptable value")) {
3751 return; 3750 return;
3752 } 3751 }
3753 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3752 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3754 if (!Utils::ApiCheck(!self->IsJSArray(), 3753 if (!Utils::ApiCheck(!self->IsJSArray(),
3755 "v8::Object::SetIndexedPropertiesToPixelData()", 3754 "v8::Object::SetIndexedPropertiesToPixelData()",
3756 "JSArray is not supported")) { 3755 "JSArray is not supported")) {
3757 return; 3756 return;
3758 } 3757 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3794 3793
3795 3794
3796 void v8::Object::SetIndexedPropertiesToExternalArrayData( 3795 void v8::Object::SetIndexedPropertiesToExternalArrayData(
3797 void* data, 3796 void* data,
3798 ExternalArrayType array_type, 3797 ExternalArrayType array_type,
3799 int length) { 3798 int length) {
3800 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3799 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3801 ON_BAILOUT(isolate, "v8::SetIndexedPropertiesToExternalArrayData()", return); 3800 ON_BAILOUT(isolate, "v8::SetIndexedPropertiesToExternalArrayData()", return);
3802 ENTER_V8(isolate); 3801 ENTER_V8(isolate);
3803 i::HandleScope scope(isolate); 3802 i::HandleScope scope(isolate);
3804 if (!Utils::ApiCheck(length >= 0 && length <= i::ExternalArray::kMaxLength, 3803 if (!Utils::ApiCheck(length >= 0 && length <= i::Smi::kMaxValue,
3805 "v8::Object::SetIndexedPropertiesToExternalArrayData()", 3804 "v8::Object::SetIndexedPropertiesToExternalArrayData()",
3806 "length exceeds max acceptable value")) { 3805 "length exceeds max acceptable value")) {
3807 return; 3806 return;
3808 } 3807 }
3809 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3808 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3810 if (!Utils::ApiCheck(!self->IsJSArray(), 3809 if (!Utils::ApiCheck(!self->IsJSArray(),
3811 "v8::Object::SetIndexedPropertiesToExternalArrayData()", 3810 "v8::Object::SetIndexedPropertiesToExternalArrayData()",
3812 "JSArray is not supported")) { 3811 "JSArray is not supported")) {
3813 return; 3812 return;
3814 } 3813 }
(...skipping 3843 matching lines...) Expand 10 before | Expand all | Expand 10 after
7658 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7657 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7659 Address callback_address = 7658 Address callback_address =
7660 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7659 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7661 VMState<EXTERNAL> state(isolate); 7660 VMState<EXTERNAL> state(isolate);
7662 ExternalCallbackScope call_scope(isolate, callback_address); 7661 ExternalCallbackScope call_scope(isolate, callback_address);
7663 callback(info); 7662 callback(info);
7664 } 7663 }
7665 7664
7666 7665
7667 } } // namespace v8::internal 7666 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698