Title: [90574] trunk/Source/WebCore
Revision
90574
Author
commit-qu...@webkit.org
Date
2011-07-07 10:29:20 -0700 (Thu, 07 Jul 2011)

Log Message

The return value of SharedBuffer::createWithContentsOfFile must have valid m_size.
https://bugs.webkit.org/show_bug.cgi?id=63313

Patch by Kyusun Kim <maniag...@company100.net> on 2011-07-07
Reviewed by Eric Seidel.

* platform/posix/SharedBufferPOSIX.cpp:
(WebCore::SharedBuffer::createWithContentsOfFile):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (90573 => 90574)


--- trunk/Source/WebCore/ChangeLog	2011-07-07 17:27:46 UTC (rev 90573)
+++ trunk/Source/WebCore/ChangeLog	2011-07-07 17:29:20 UTC (rev 90574)
@@ -1,3 +1,13 @@
+2011-07-07  Kyusun Kim  <maniag...@company100.net>
+
+        The return value of SharedBuffer::createWithContentsOfFile must have valid m_size.
+        https://bugs.webkit.org/show_bug.cgi?id=63313
+
+        Reviewed by Eric Seidel.
+
+        * platform/posix/SharedBufferPOSIX.cpp:
+        (WebCore::SharedBuffer::createWithContentsOfFile):
+
 2011-07-07  Dan Bernstein  <m...@apple.com>
 
         <rdar://problem/9737435> Re-enable -webkit-column-break-inside: avoid

Modified: trunk/Source/WebCore/platform/posix/SharedBufferPOSIX.cpp (90573 => 90574)


--- trunk/Source/WebCore/platform/posix/SharedBufferPOSIX.cpp	2011-07-07 17:27:46 UTC (rev 90573)
+++ trunk/Source/WebCore/platform/posix/SharedBufferPOSIX.cpp	2011-07-07 17:29:20 UTC (rev 90574)
@@ -57,17 +57,16 @@
         return 0;
     }
 
-    RefPtr<SharedBuffer> result = create();
-    result->m_buffer.grow(bytesToRead);
+    Vector<char> buffer(bytesToRead);
 
     size_t totalBytesRead = 0;
     ssize_t bytesRead;
-    while ((bytesRead = read(fd, result->m_buffer.data() + totalBytesRead, bytesToRead - totalBytesRead)) > 0)
+    while ((bytesRead = read(fd, buffer.data() + totalBytesRead, bytesToRead - totalBytesRead)) > 0)
         totalBytesRead += bytesRead;
 
     close(fd);
 
-    return totalBytesRead == bytesToRead ? result.release() : 0;
+    return totalBytesRead == bytesToRead ? SharedBuffer::adoptVector(buffer) : 0;
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to