Title: [98758] trunk/Tools
Revision
98758
Author
[email protected]
Date
2011-10-28 13:46:29 -0700 (Fri, 28 Oct 2011)

Log Message

NRWT crashes when parsing leaks output due to UTF-8 decoding error
https://bugs.webkit.org/show_bug.cgi?id=71112

Reviewed by Adam Barth.

Use read_binary_file instead of read_text_file and add a test
case with some non-utf8 data to make sure we don't break this in the future.

* Scripts/webkitpy/layout_tests/port/leakdetector.py:
* Scripts/webkitpy/layout_tests/port/leakdetector_unittest.py:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (98757 => 98758)


--- trunk/Tools/ChangeLog	2011-10-28 20:44:58 UTC (rev 98757)
+++ trunk/Tools/ChangeLog	2011-10-28 20:46:29 UTC (rev 98758)
@@ -1,3 +1,16 @@
+2011-10-28  Eric Seidel  <[email protected]>
+
+        NRWT crashes when parsing leaks output due to UTF-8 decoding error
+        https://bugs.webkit.org/show_bug.cgi?id=71112
+
+        Reviewed by Adam Barth.
+
+        Use read_binary_file instead of read_text_file and add a test
+        case with some non-utf8 data to make sure we don't break this in the future.
+
+        * Scripts/webkitpy/layout_tests/port/leakdetector.py:
+        * Scripts/webkitpy/layout_tests/port/leakdetector_unittest.py:
+
 2011-10-28  David Levin  <[email protected]>
 
         watchlist should not CC the bug reporter

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/leakdetector.py (98757 => 98758)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/leakdetector.py	2011-10-28 20:44:58 UTC (rev 98757)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/leakdetector.py	2011-10-28 20:46:29 UTC (rev 98758)
@@ -120,7 +120,9 @@
     def count_total_leaks(self, leak_file_paths):
         total_leaks = 0
         for leak_file_path in leak_file_paths:
-            leaks_output = self._filesystem.read_text_file(leak_file_path)
+            # Leaks have been seen to include non-utf8 data, so we use read_binary_file.
+            # See https://bugs.webkit.org/show_bug.cgi?id=71112.
+            leaks_output = self._filesystem.read_binary_file(leak_file_path)
             count, _, _ = self._parse_leaks_output(leaks_output)
             total_leaks += count
         return total_leaks

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/leakdetector_unittest.py (98757 => 98758)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/leakdetector_unittest.py	2011-10-28 20:44:58 UTC (rev 98757)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/leakdetector_unittest.py	2011-10-28 20:46:29 UTC (rev 98758)
@@ -109,7 +109,8 @@
     def test_count_total_leaks(self):
         detector = self._make_detector()
         detector._filesystem = MockFileSystem({
-            '/mock-results/DumpRenderTree-1234-leaks.txt': 'Process 1234: 12 leaks for 40 total leaked bytes.\n',
+            # The \xff is some non-utf8 characters to make sure we don't blow up trying to parse the file.
+            '/mock-results/DumpRenderTree-1234-leaks.txt': '\xff\nProcess 1234: 12 leaks for 40 total leaked bytes.\n\xff\n',
             '/mock-results/DumpRenderTree-23423-leaks.txt': 'Process 1235: 12341 leaks for 27934 total leaked bytes.\n',
             '/mock-results/DumpRenderTree-823-leaks.txt': 'Process 12356: 23412 leaks for 18 total leaked bytes.\n',
         })
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to