A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/django/django/commit/da33d67181b53fe6cc737ac1220153814a1509f6 below:

[1.4.x] Fixed a security issue in image uploading. Disclosure and rel… · django/django@da33d67 · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+6

-1

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+6

-1

lines changed Original file line number Diff line number Diff line change

@@ -47,13 +47,18 @@ def get_image_dimensions(file_or_path, close=False):

47 47

file = open(file_or_path, 'rb')

48 48

close = True

49 49

try:

50 +

# Most of the time PIL only needs a small chunk to parse the image and

51 +

# get the dimensions, but with some TIFF files PIL needs to parse the

52 +

# whole file.

53 +

chunk_size = 1024

50 54

while 1:

51 -

data = file.read(1024)

55 +

data = file.read(chunk_size)

52 56

if not data:

53 57

break

54 58

p.feed(data)

55 59

if p.image:

56 60

return p.image.size

61 +

chunk_size = chunk_size*2

57 62

return None

58 63

finally:

59 64

if close:

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4