[Image-SIG] PIL 1.1.6 ImageFile.Parser destroys data for PngImagePlugin

Alexey Borzenkov snaury at gmail.com
Fri Nov 20 14:33:29 CET 2009


Hi Fredrik,

On Wed, Nov 4, 2009 at 6:43 PM, Fredrik Lundh <fredrik at pythonware.com> wrote:
> Thanks for the detailed analysis.  The fix in 1.1.7 is slightly
> different from the one you propose:
>
>    http://hg.effbot.org/pil-2009-raclette/changeset/fe4688f15fed/
>
> Not sure why the code considers it important to close the file at that
> point; I'll take another look at a look at the code and the history of
> that file when I find the time.

I looked at your changeset, and wonder why do you call image.load() in
finally? If Image.open fails, then self.image.load will also fail,
masking the original exception with attribute error. I don't remember
what I posted back then, but my patch was a little different:

http://git.kitsu.ru/patched/pil.git?a=commitdiff;h=943d371a903bf2af8ebc6b3be908bcdd6f8d0964


More information about the Image-SIG mailing list