~ubuntu-branches/ubuntu/precise/python-django/precise-security

« back to all changes in this revision

Viewing changes to debian/patches/security_image_uploading

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers, Scott Kitterman, Marc Deslauriers
  • Date: 2012-09-06 08:36:28 UTC
  • Revision ID: package-import@ubuntu.com-20120906083628-moj04kqjgvoo53ow
Tags: 1.3.1-4ubuntu1.2
[ Scott Kitterman ]
* SECURITY UPDATE: multiple issues (LP: #1031733)
* References CVE-2012-3442 CVE-2012-3443 CVE-2012-3444
  https://www.djangoproject.com/weblog/2012/jul/30/security-releases-issued/
* New upstream release to address three security issues:
  - Cross-site scripting in authentication views
  - Denial-of-service in image validation
  - Denial-of-service via get_image_dimensions()
* Added debian/patches/security_http_redirects,
  security_image_uploading_two, and security_image_uploading cherry picked
  from upstream git

[ Marc Deslauriers ]
* debian/patches/security_http_redirects: remove unrelated changes, add
  python 2.4 regression fix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Origin: https://github.com/django/django/commit/9ca0ff6268eeff92d0d0ac2c315d4b6a8e229155
 
2
Subject: Denial-of-service in image validation
 
3
 
 
4
https://www.djangoproject.com/weblog/2012/jul/30/security-releases-issued/
 
5
 
 
6
CVE-2012-3443
 
7
 
 
8
Index: python-django-1.3.1/django/core/files/images.py
 
9
===================================================================
 
10
--- python-django-1.3.1.orig/django/core/files/images.py        2010-09-10 14:45:25.000000000 -0400
 
11
+++ python-django-1.3.1/django/core/files/images.py     2012-08-14 18:28:27.895124158 -0400
 
12
@@ -47,13 +47,18 @@
 
13
         file = open(file_or_path, 'rb')
 
14
         close = True
 
15
     try:
 
16
+        # Most of the time PIL only needs a small chunk to parse the image and
 
17
+        # get the dimensions, but with some TIFF files PIL needs to parse the
 
18
+        # whole file.
 
19
+        chunk_size = 1024
 
20
         while 1:
 
21
-            data = file.read(1024)
 
22
+            data = file.read(chunk_size)
 
23
             if not data:
 
24
                 break
 
25
             p.feed(data)
 
26
             if p.image:
 
27
                 return p.image.size
 
28
+            chunk_size = chunk_size*2
 
29
         return None
 
30
     finally:
 
31
         if close: