Blob Blame History Raw
commit 996ae09c6e1264439722fa47d38d83b351dc93e5
Author: jomae <jomae@af82e41b-90c4-0310-8c96-b1721e28e2e2>
Date:   Thu Nov 6 06:48:13 2014 +0000

    1.0.3dev: don't pass an iterable instance to `RequestDone` to avoid SEGVs when downloading content of Subversion node (closes #11805)
    
    
    git-svn-id: http://trac.edgewall.org/intertrac/log:/branches/1.0-stable@13243 af82e41b-90c4-0310-8c96-b1721e28e2e2

diff --git a/trac/versioncontrol/web_ui/browser.py b/trac/versioncontrol/web_ui/browser.py
index 8d84d36..1ac1348 100644
--- a/trac/versioncontrol/web_ui/browser.py
+++ b/trac/versioncontrol/web_ui/browser.py
@@ -691,13 +691,12 @@ class BrowserModule(Component):
                 # XSS attacks
                 req.send_header('Content-Disposition', 'attachment')
             req.end_headers()
-
-            def chunks():
-                c = chunk
-                while c:
-                    yield c
-                    c = content.read(CHUNK_SIZE)
-            raise RequestDone(chunks())
+            # Note: don't pass an iterable instance to RequestDone, instead
+            # call req.write() with each chunk here to avoid SEGVs (#11805)
+            while chunk:
+                req.write(chunk)
+                chunk = content.read(CHUNK_SIZE)
+            raise RequestDone
         else:
             # The changeset corresponding to the last change on `node`
             # is more interesting than the `rev` changeset.