Title: [213223] trunk/Source/WTF
- Revision
- 213223
- Author
- tpop...@redhat.com
- Date
- 2017-03-01 07:43:54 -0800 (Wed, 01 Mar 2017)
Log Message
[WTF] va_list is not ended in StringPrintStream
https://bugs.webkit.org/show_bug.cgi?id=169035
Reviewed by Michael Saboff.
Also fix whitespace errors while touching this file.
* wtf/StringPrintStream.cpp:
(WTF::StringPrintStream::vprintf):
(WTF::StringPrintStream::increaseSize):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (213222 => 213223)
--- trunk/Source/WTF/ChangeLog 2017-03-01 15:38:14 UTC (rev 213222)
+++ trunk/Source/WTF/ChangeLog 2017-03-01 15:43:54 UTC (rev 213223)
@@ -1,3 +1,16 @@
+2017-03-01 Tomas Popela <tpop...@redhat.com>
+
+ [WTF] va_list is not ended in StringPrintStream
+ https://bugs.webkit.org/show_bug.cgi?id=169035
+
+ Reviewed by Michael Saboff.
+
+ Also fix whitespace errors while touching this file.
+
+ * wtf/StringPrintStream.cpp:
+ (WTF::StringPrintStream::vprintf):
+ (WTF::StringPrintStream::increaseSize):
+
2017-03-01 Andreas Kling <akl...@apple.com>
Move MemoryPressureHandler to WTF
Modified: trunk/Source/WTF/wtf/StringPrintStream.cpp (213222 => 213223)
--- trunk/Source/WTF/wtf/StringPrintStream.cpp 2017-03-01 15:38:14 UTC (rev 213222)
+++ trunk/Source/WTF/wtf/StringPrintStream.cpp 2017-03-01 15:43:54 UTC (rev 213223)
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
@@ -52,32 +52,34 @@
{
ASSERT_WITH_SECURITY_IMPLICATION(m_next < m_size);
ASSERT(!m_buffer[m_next]);
-
+
va_list firstPassArgList;
va_copy(firstPassArgList, argList);
-
+
int numberOfBytesNotIncludingTerminatorThatWouldHaveBeenWritten =
vsnprintf(m_buffer + m_next, m_size - m_next, format, firstPassArgList);
-
+
+ va_end(firstPassArgList);
+
int numberOfBytesThatWouldHaveBeenWritten =
numberOfBytesNotIncludingTerminatorThatWouldHaveBeenWritten + 1;
-
+
if (m_next + numberOfBytesThatWouldHaveBeenWritten <= m_size) {
m_next += numberOfBytesNotIncludingTerminatorThatWouldHaveBeenWritten;
return; // This means that vsnprintf() succeeded.
}
-
+
increaseSize(m_next + numberOfBytesThatWouldHaveBeenWritten);
-
+
int numberOfBytesNotIncludingTerminatorThatWereWritten =
vsnprintf(m_buffer + m_next, m_size - m_next, format, argList);
-
+
int numberOfBytesThatWereWritten = numberOfBytesNotIncludingTerminatorThatWereWritten + 1;
-
+
ASSERT_UNUSED(numberOfBytesThatWereWritten, m_next + numberOfBytesThatWereWritten <= m_size);
-
+
m_next += numberOfBytesNotIncludingTerminatorThatWereWritten;
-
+
ASSERT_WITH_SECURITY_IMPLICATION(m_next < m_size);
ASSERT(!m_buffer[m_next]);
}
@@ -110,10 +112,10 @@
{
ASSERT_WITH_SECURITY_IMPLICATION(newSize > m_size);
ASSERT(newSize > sizeof(m_inlineBuffer));
-
+
// Use exponential resizing to reduce thrashing.
m_size = newSize << 1;
-
+
// Use fastMalloc instead of fastRealloc because we know that for the sizes we're using,
// fastRealloc will just do malloc+free anyway. Also, this simplifies the code since
// we can't realloc the inline buffer.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes