djhenderson / pefile

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

stringfileinfo_string is sometimes None #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. 'stringfileinfo_struct' is None sometimes. 
This happens for some PE files with no version information, but run just
fine. (other PE viewers work fine too)  

What is the expected output? What do you see instead?
We would expect pefile to load the file normally. But we see a traceback.

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
line 1341, in __init__
line 1630, in __parse__
line 1902, in parse_data_directories
line 2287, in parse_resources_directory
line 2491, in parse_version_information
AttributeError: 'NoneType' object has no attribute 'startswith'  

What version of the product are you using? On what operating system?
__revision__ = "$LastChangedRevision: 68 $"
OSX 10.5.8 , Python 2.5

Please provide any additional information below.
add an extra check for NoneType on stringfileinfo_string before using it. 
2 places - line nos 2491,2614 on revision 68. 

temporary fix : line 2491 on revision 68:
if stringfileinfo_string and
stringfileinfo_string.startswith(u'StringFileInfo'):

line 2614 on revision 68:
elif stringfileinfo_string and stringfileinfo_string.startswith(
u'VarFileInfo' ):

Original issue reported on code.google.com by kbandla%...@gtempaccount.com on 18 Mar 2010 at 8:20

GoogleCodeExporter commented 9 years ago
Probably fixed in revision 78. Sounds very similar to the problem reported in 
issue 14

Original comment by ero.carr...@gmail.com on 16 Aug 2010 at 11:16