2007-07-06 Tony Chang <idealisms@gmail.com>
authorbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jul 2007 10:03:38 +0000 (10:03 +0000)
committerbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jul 2007 10:03:38 +0000 (10:03 +0000)
        Reviewed by Maciej.

        http://bugs.webkit.org/show_bug.cgi?id=14516
        Bug 14516: crash loading multipart/x-mixed-replace data on windows safari

        NULL check m_resourceData to prevent a crash in Safari on Windows.

        * loader/ResourceLoader.cpp:
        (WebCore::ResourceLoader::clearResourceData):

2007-07-06  Tony Chang  <idealisms@gmail.com>

        Reviewed by Maciej.

        http://bugs.webkit.org/show_bug.cgi?id=14516
        Bug 14516: crash loading multipart/x-mixed-replace data on windows safari

        * http/tests/multipart/resources/multipart-nodashes.php: Added.
        * http/tests/multipart/win-boundary-crash-expected.txt: Added.
        * http/tests/multipart/win-boundary-crash.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@24053 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/multipart/resources/multipart-nodashes.php [new file with mode: 0644]
LayoutTests/http/tests/multipart/win-boundary-crash-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/multipart/win-boundary-crash.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/loader/ResourceLoader.cpp

index 65f695b..07dd59b 100644 (file)
@@ -1,3 +1,14 @@
+2007-07-06  Tony Chang  <idealisms@gmail.com>
+
+        Reviewed by Maciej.
+
+        http://bugs.webkit.org/show_bug.cgi?id=14516
+        Bug 14516: crash loading multipart/x-mixed-replace data on windows safari
+
+        * http/tests/multipart/resources/multipart-nodashes.php: Added.
+        * http/tests/multipart/win-boundary-crash-expected.txt: Added.
+        * http/tests/multipart/win-boundary-crash.html: Added.
+
 2007-07-06  Jungshik Shin <jungshik.shin@gmail.com>
 
         Reviewed by Alexey.
 2007-07-06  Jungshik Shin <jungshik.shin@gmail.com>
 
         Reviewed by Alexey.
diff --git a/LayoutTests/http/tests/multipart/resources/multipart-nodashes.php b/LayoutTests/http/tests/multipart/resources/multipart-nodashes.php
new file mode 100644 (file)
index 0000000..f0891f1
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+    # Generates a multipart/x-mixed-replace response but doesn't
+    # include the -- before the boundary.
+
+    $boundary = "cutHere";
+    header("Content-Type: multipart/x-mixed-replace; boundary=$boundary");
+    echo("$boundary\r\n");
+    echo("Content-Type: image/png\r\n\r\n");
+    echo(file_get_contents("green-100x100.png"));
+?>
diff --git a/LayoutTests/http/tests/multipart/win-boundary-crash-expected.txt b/LayoutTests/http/tests/multipart/win-boundary-crash-expected.txt
new file mode 100644 (file)
index 0000000..32219ad
--- /dev/null
@@ -0,0 +1,5 @@
+Test for http://bugs.webkit.org/show_bug.cgi?id=14516 crash loading multipart/x-mixed-replace data on windows safari
+
+If WebKit does not crash when loading this img, then it passed.
+
+
diff --git a/LayoutTests/http/tests/multipart/win-boundary-crash.html b/LayoutTests/http/tests/multipart/win-boundary-crash.html
new file mode 100644 (file)
index 0000000..78f4254
--- /dev/null
@@ -0,0 +1,14 @@
+<html>
+<head>
+<script>
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+</script>
+</head>
+<body>
+<p>Test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=14516">http://bugs.webkit.org/show_bug.cgi?id=14516</a>
+crash loading multipart/x-mixed-replace data on windows safari</i></p>
+<p>If WebKit does not crash when loading this img, then it passed.</p>
+<img src="resources/multipart-nodashes.php" />
+</body>
+</html>
index 8daa8c8..08c7a7a 100644 (file)
@@ -1,3 +1,15 @@
+2007-07-06  Tony Chang  <idealisms@gmail.com>
+
+        Reviewed by Maciej.
+
+        http://bugs.webkit.org/show_bug.cgi?id=14516
+        Bug 14516: crash loading multipart/x-mixed-replace data on windows safari
+
+        NULL check m_resourceData to prevent a crash in Safari on Windows.
+
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::clearResourceData):
+
 2007-07-06  Jungshik Shin  <jungshik.shin@gmail.com>
 
         Reviewed by Alexey.
 2007-07-06  Jungshik Shin  <jungshik.shin@gmail.com>
 
         Reviewed by Alexey.
index 8ba007d..ebbb887 100644 (file)
@@ -161,7 +161,8 @@ void ResourceLoader::addData(const char* data, int length, bool allAtOnce)
 
 void ResourceLoader::clearResourceData()
 {
 
 void ResourceLoader::clearResourceData()
 {
-    m_resourceData->clear();
+    if (m_resourceData)
+        m_resourceData->clear();
 }
 
 void ResourceLoader::willSendRequest(ResourceRequest& request, const ResourceResponse& redirectResponse)
 }
 
 void ResourceLoader::willSendRequest(ResourceRequest& request, const ResourceResponse& redirectResponse)