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

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 1683243002: Fix for issue 27094147 (Null pointer deref in IsScriptSnapshot). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 | « 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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_mirrors_api.h" 6 #include "include/dart_mirrors_api.h"
7 #include "include/dart_native_api.h" 7 #include "include/dart_native_api.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "lib/stacktrace.h" 10 #include "lib/stacktrace.h"
(...skipping 5113 matching lines...) Expand 10 before | Expand all | Expand 10 after
5124 API_TIMELINE_DURATION; 5124 API_TIMELINE_DURATION;
5125 DARTSCOPE(Thread::Current()); 5125 DARTSCOPE(Thread::Current());
5126 Isolate* I = T->isolate(); 5126 Isolate* I = T->isolate();
5127 StackZone zone(T); 5127 StackZone zone(T);
5128 if (buffer == NULL) { 5128 if (buffer == NULL) {
5129 RETURN_NULL_ERROR(buffer); 5129 RETURN_NULL_ERROR(buffer);
5130 } 5130 }
5131 NoHeapGrowthControlScope no_growth_control; 5131 NoHeapGrowthControlScope no_growth_control;
5132 5132
5133 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); 5133 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer);
5134 if (snapshot == NULL) {
5135 return Api::NewError("%s expects parameter 'buffer' to be a script type"
5136 " snapshot with a valid length.", CURRENT_FUNC);
5137 }
5134 if (!snapshot->IsScriptSnapshot()) { 5138 if (!snapshot->IsScriptSnapshot()) {
5135 return Api::NewError("%s expects parameter 'buffer' to be a script type" 5139 return Api::NewError("%s expects parameter 'buffer' to be a script type"
5136 " snapshot.", CURRENT_FUNC); 5140 " snapshot.", CURRENT_FUNC);
5137 } 5141 }
5138 if (snapshot->length() != buffer_len) { 5142 if (snapshot->length() != buffer_len) {
5139 return Api::NewError("%s: 'buffer_len' of %" Pd " is not equal to %" Pd 5143 return Api::NewError("%s: 'buffer_len' of %" Pd " is not equal to %" Pd
5140 " which is the expected length in the snapshot.", 5144 " which is the expected length in the snapshot.",
5141 CURRENT_FUNC, buffer_len, snapshot->length()); 5145 CURRENT_FUNC, buffer_len, snapshot->length());
5142 } 5146 }
5143 Library& library = Library::Handle(Z, I->object_store()->root_library()); 5147 Library& library = Library::Handle(Z, I->object_store()->root_library());
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
6157 return Api::Success(); 6161 return Api::Success();
6158 } 6162 }
6159 #endif // DART_PRECOMPILER 6163 #endif // DART_PRECOMPILER
6160 6164
6161 6165
6162 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { 6166 DART_EXPORT bool Dart_IsRunningPrecompiledCode() {
6163 return Dart::IsRunningPrecompiledCode(); 6167 return Dart::IsRunningPrecompiledCode();
6164 } 6168 }
6165 6169
6166 } // namespace dart 6170 } // namespace dart
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