Fixed #19457 - ImageField size detection fails for some files even when PIL could succeed #586

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
@apollo13

This comment has been minimized.

Show comment
Hide comment
@apollo13

apollo13 Dec 30, 2012

Member

What about the picture license? Are we allowed to include it? If not sure please create your own.

Member

apollo13 commented Dec 30, 2012

What about the picture license? Are we allowed to include it? If not sure please create your own.

@bak1an

This comment has been minimized.

Show comment
Hide comment
@bak1an

bak1an Dec 30, 2012

Contributor

ok, i will create some random png image with big zTXt section and update pull request

Contributor

bak1an commented Dec 30, 2012

ok, i will create some random png image with big zTXt section and update pull request

@bak1an

This comment has been minimized.

Show comment
Hide comment
@bak1an

bak1an Dec 31, 2012

Contributor

@apollo13 pull request updated with new image now.
it's generated with this script https://github.com/moljac024/scripts/blob/master/other/konify.pl and contains 10KB from my /dev/urandom within it's metadata. so it's free from any copyrights now.

i also added check to except block to ensure that we are ignoring only "truncated stream" errors and reraise other exceptions from zlib.

Contributor

bak1an commented Dec 31, 2012

@apollo13 pull request updated with new image now.
it's generated with this script https://github.com/moljac024/scripts/blob/master/other/konify.pl and contains 10KB from my /dev/urandom within it's metadata. so it's free from any copyrights now.

i also added check to except block to ensure that we are ignoring only "truncated stream" errors and reraise other exceptions from zlib.

@bak1an

This comment has been minimized.

Show comment
Hide comment
@bak1an

bak1an Dec 31, 2012

Contributor

also, i know that checking error code with str.startswith() is at least strange, but it looks like we have no other choice, because zlib does not save it anywhere else and return only formatted string with error description.

http://hg.python.org/cpython/file/f6fb5a5748f0/Modules/zlibmodule.c#l77

or i'm missing something?

Contributor

bak1an commented Dec 31, 2012

also, i know that checking error code with str.startswith() is at least strange, but it looks like we have no other choice, because zlib does not save it anywhere else and return only formatted string with error description.

http://hg.python.org/cpython/file/f6fb5a5748f0/Modules/zlibmodule.c#l77

or i'm missing something?

@apollo13

This comment has been minimized.

Show comment
Hide comment
@apollo13

apollo13 Jan 1, 2013

Member

Commited, Thx!

Member

apollo13 commented Jan 1, 2013

Commited, Thx!

@apollo13 apollo13 closed this Jan 1, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment