Title: [234192] trunk/Source/WTF
Revision
234192
Author
tpop...@redhat.com
Date
2018-07-25 00:11:21 -0700 (Wed, 25 Jul 2018)

Log Message

Correctly close the variable argument list
https://bugs.webkit.org/show_bug.cgi?id=186758

Reviewed by Michael Catanzaro.

The argcCopy is not ended when we early return. Also don't call
va_end() on args because it's closed in caller.

* wtf/text/WTFString.cpp:
(WTF::createWithFormatAndArguments):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (234191 => 234192)


--- trunk/Source/WTF/ChangeLog	2018-07-25 06:02:19 UTC (rev 234191)
+++ trunk/Source/WTF/ChangeLog	2018-07-25 07:11:21 UTC (rev 234192)
@@ -1,3 +1,16 @@
+2018-07-25  Tomas Popela  <tpop...@redhat.com>
+
+        Correctly close the variable argument list
+        https://bugs.webkit.org/show_bug.cgi?id=186758
+
+        Reviewed by Michael Catanzaro.
+
+        The argcCopy is not ended when we early return. Also don't call
+        va_end() on args because it's closed in caller.
+
+        * wtf/text/WTFString.cpp:
+        (WTF::createWithFormatAndArguments):
+
 2018-07-24  Tim Horton  <timothy_hor...@apple.com>
 
         HAVE(PARENTAL_CONTROLS) should be true on watchOS

Modified: trunk/Source/WTF/wtf/text/WTFString.cpp (234191 => 234192)


--- trunk/Source/WTF/wtf/text/WTFString.cpp	2018-07-25 06:02:19 UTC (rev 234191)
+++ trunk/Source/WTF/wtf/text/WTFString.cpp	2018-07-25 07:11:21 UTC (rev 234192)
@@ -462,7 +462,7 @@
     if (strstr(format, "%@")) {
         auto cfFormat = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, format, kCFStringEncodingUTF8));
         auto result = adoptCF(CFStringCreateWithFormatAndArguments(kCFAllocatorDefault, nullptr, cfFormat.get(), args));
-        va_end(args);
+        va_end(argsCopy);
         return result.get();
     }
 #endif
@@ -474,12 +474,15 @@
     char ch;
     int result = vsnprintf(&ch, 1, format, args);
 #endif
-    va_end(args);
 
-    if (result == 0)
+    if (!result) {
+        va_end(argsCopy);
         return emptyString();
-    if (result < 0)
+    }
+    if (result < 0) {
+        va_end(argsCopy);
         return String();
+    }
 
     Vector<char, 256> buffer;
     unsigned len = result;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to