Reviewers: ulan,

Description:
Add check to external string resource.

Extensions are a source of external strings where we don't perform check yet.

[email protected]
BUG=


Please review this at https://chromiumcodereview.appspot.com/10878025/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M include/v8.h
  M src/api.cc


Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index b210638871c08b4f1e9ef050f184b7307dbf639a..3c00ce2cfe9388d6ceb86439225b852a7dbf7565 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -2539,7 +2539,7 @@ class V8EXPORT Extension {  // NOLINT
   // Note that the strings passed into this constructor must live as long
   // as the Extension itself.
   Extension(const char* name,
-            const char* source = 0,
+            const char* source,
             int dep_count = 0,
             const char** deps = 0,
             int source_length = -1);
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index c8a9e90821a1ced337c8b3ddfed526f7c6cfc69f..0da6ab7378a4440178df3b8ece77c4db71353a3c 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -537,11 +537,13 @@ Extension::Extension(const char* name,
     : name_(name),
       source_length_(source_length >= 0 ?
                      source_length :
-                     (source ? static_cast<int>(strlen(source)) : 0)),
+                     static_cast<int>(strlen(source))),
       source_(source, source_length_),
       dep_count_(dep_count),
       deps_(deps),
-      auto_enable_(false) { }
+      auto_enable_(false) {
+  CHECK(source);
+}


 v8::Handle<Primitive> Undefined() {


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to