Title: [213242] trunk/Source/_javascript_Core
Revision
213242
Author
[email protected]
Date
2017-03-01 14:28:23 -0800 (Wed, 01 Mar 2017)

Log Message

Source/_javascript_Core/ChangeLog
https://bugs.webkit.org/show_bug.cgi?id=169055

Reviewed by Mark Lam.

Made local copies of options strings for OptionRange and string typed options.

* runtime/Options.cpp:
(JSC::parse):
(JSC::OptionRange::init):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (213241 => 213242)


--- trunk/Source/_javascript_Core/ChangeLog	2017-03-01 22:01:13 UTC (rev 213241)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-03-01 22:28:23 UTC (rev 213242)
@@ -1,3 +1,16 @@
+2017-03-01  Michael Saboff  <[email protected]>
+
+        Source/_javascript_Core/ChangeLog
+        https://bugs.webkit.org/show_bug.cgi?id=169055
+
+        Reviewed by Mark Lam.
+
+        Made local copies of options strings for OptionRange and string typed options.
+
+        * runtime/Options.cpp:
+        (JSC::parse):
+        (JSC::OptionRange::init):
+
 2017-03-01  Mark Lam  <[email protected]>
 
         [Re-landing] Change JSLock to stash PlatformThread instead of std::thread::id.

Modified: trunk/Source/_javascript_Core/runtime/Options.cpp (213241 => 213242)


--- trunk/Source/_javascript_Core/runtime/Options.cpp	2017-03-01 22:01:13 UTC (rev 213241)
+++ trunk/Source/_javascript_Core/runtime/Options.cpp	2017-03-01 22:28:23 UTC (rev 213242)
@@ -101,9 +101,14 @@
 
 static bool parse(const char* string, const char*& value)
 {
-    if (!strlen(string))
-        string = nullptr;
-    value = string;
+    if (!strlen(string)) {
+        value = nullptr;
+        return true;
+    }
+
+    // FIXME <https://webkit.org/b/169057>: This could leak if this option is set more than once.
+    // Given that Options are typically used for testing, this isn't considered to be a problem.
+    value = WTF::fastStrDup(string);
     return true;
 }
 
@@ -222,14 +227,14 @@
         return true;
     }
     
-    m_rangeString = rangeString;
+    const char* p = rangeString;
 
-    if (*rangeString == '!') {
+    if (*p == '!') {
         invert = true;
-        rangeString++;
+        p++;
     }
 
-    int scanResult = sscanf(rangeString, " %u:%u", &m_lowLimit, &m_highLimit);
+    int scanResult = sscanf(p, " %u:%u", &m_lowLimit, &m_highLimit);
 
     if (!scanResult || scanResult == EOF) {
         m_state = InitError;
@@ -244,6 +249,9 @@
         return false;
     }
 
+    // FIXME <https://webkit.org/b/169057>: This could leak if this particular option is set more than once.
+    // Given that these options are used for testing, this isn't considered to be problem.
+    m_rangeString = WTF::fastStrDup(rangeString);
     m_state = invert ? Inverted : Normal;
 
     return true;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to