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

Side by Side Diff: src/api.cc

Issue 10914257: Fix API check for length of external arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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 | test/cctest/test-api.cc » ('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 3386 matching lines...) Expand 10 before | Expand all | Expand 10 after
3397 } 3397 }
3398 3398
3399 } // namespace 3399 } // namespace
3400 3400
3401 3401
3402 void v8::Object::SetIndexedPropertiesToPixelData(uint8_t* data, int length) { 3402 void v8::Object::SetIndexedPropertiesToPixelData(uint8_t* data, int length) {
3403 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3403 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3404 ON_BAILOUT(isolate, "v8::SetElementsToPixelData()", return); 3404 ON_BAILOUT(isolate, "v8::SetElementsToPixelData()", return);
3405 ENTER_V8(isolate); 3405 ENTER_V8(isolate);
3406 i::HandleScope scope(isolate); 3406 i::HandleScope scope(isolate);
3407 if (!ApiCheck(length <= i::ExternalPixelArray::kMaxLength, 3407 if (!ApiCheck(length >= 0 && length <= i::ExternalPixelArray::kMaxLength,
3408 "v8::Object::SetIndexedPropertiesToPixelData()", 3408 "v8::Object::SetIndexedPropertiesToPixelData()",
3409 "length exceeds max acceptable value")) { 3409 "length exceeds max acceptable value")) {
3410 return; 3410 return;
3411 } 3411 }
3412 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3412 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3413 if (!ApiCheck(!self->IsJSArray(), 3413 if (!ApiCheck(!self->IsJSArray(),
3414 "v8::Object::SetIndexedPropertiesToPixelData()", 3414 "v8::Object::SetIndexedPropertiesToPixelData()",
3415 "JSArray is not supported")) { 3415 "JSArray is not supported")) {
3416 return; 3416 return;
3417 } 3417 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3453 3453
3454 3454
3455 void v8::Object::SetIndexedPropertiesToExternalArrayData( 3455 void v8::Object::SetIndexedPropertiesToExternalArrayData(
3456 void* data, 3456 void* data,
3457 ExternalArrayType array_type, 3457 ExternalArrayType array_type,
3458 int length) { 3458 int length) {
3459 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3459 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3460 ON_BAILOUT(isolate, "v8::SetIndexedPropertiesToExternalArrayData()", return); 3460 ON_BAILOUT(isolate, "v8::SetIndexedPropertiesToExternalArrayData()", return);
3461 ENTER_V8(isolate); 3461 ENTER_V8(isolate);
3462 i::HandleScope scope(isolate); 3462 i::HandleScope scope(isolate);
3463 if (!ApiCheck(length <= i::ExternalArray::kMaxLength, 3463 if (!ApiCheck(length >= 0 && length <= i::ExternalArray::kMaxLength,
3464 "v8::Object::SetIndexedPropertiesToExternalArrayData()", 3464 "v8::Object::SetIndexedPropertiesToExternalArrayData()",
3465 "length exceeds max acceptable value")) { 3465 "length exceeds max acceptable value")) {
3466 return; 3466 return;
3467 } 3467 }
3468 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3468 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3469 if (!ApiCheck(!self->IsJSArray(), 3469 if (!ApiCheck(!self->IsJSArray(),
3470 "v8::Object::SetIndexedPropertiesToExternalArrayData()", 3470 "v8::Object::SetIndexedPropertiesToExternalArrayData()",
3471 "JSArray is not supported")) { 3471 "JSArray is not supported")) {
3472 return; 3472 return;
3473 } 3473 }
(...skipping 3103 matching lines...) Expand 10 before | Expand all | Expand 10 after
6577 6577
6578 v->VisitPointers(blocks_.first(), first_block_limit_); 6578 v->VisitPointers(blocks_.first(), first_block_limit_);
6579 6579
6580 for (int i = 1; i < blocks_.length(); i++) { 6580 for (int i = 1; i < blocks_.length(); i++) {
6581 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 6581 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
6582 } 6582 }
6583 } 6583 }
6584 6584
6585 6585
6586 } } // namespace v8::internal 6586 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698