kongo86 / pefile

Automatically exported from code.google.com/p/pefile
Other
0 stars 0 forks source link

fd.close() may be called on unassigned fd #53

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
(Originally submitted by https://github.com/Hexadite-Max)

In the "try" statement the call to file(fname, 'rb') may fail to various 
reasons, however the exception that it throws gets lost due to the call to 
fd.close() as there is no fd which results in:

File "C:\Python27\lib\site-packages\pefile.py", line 1810, in parse
UnboundLocalError: local variable 'fd' referenced before assignment

Patch attached. 

Original issue reported on code.google.com by ikiri...@gmail.com on 9 Oct 2014 at 2:23

Attachments:

GoogleCodeExporter commented 9 years ago
One way to reproduce use this to remove the read permissions for the file.

Original comment by pvadr...@gmail.com on 22 Oct 2014 at 11:50

GoogleCodeExporter commented 9 years ago

Original comment by ero.carr...@gmail.com on 27 Oct 2014 at 3:29

GoogleCodeExporter commented 9 years ago
Related to issue 49.

Original comment by ero.carr...@gmail.com on 27 Oct 2014 at 3:37