andyvand / pefile

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

pe.write() error on increase of field size in FileInfo[0].StringTable[0].entries #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. pe=pefile.PE(myfile)
2. pe.FileInfo[0].StringTable[0].entries['FileVersion']
3. From the resulting output increase the value in FileVersion
e.g. if output was u'1.0.0.1' increase to u'1.0.0.100'
4. pe.write(myfile)
5. del pe
6. repopen myfile
7. pe.FileInfo[0].StringTable[0].entries

What is the expected output? 
The FileVersion is updated to u'1.0.0.100' and the other values (Company name 
etc) remain the same

What do you see instead?
The StringTable is corrupted

Extra Info.
If you dont increase the size of FileVersion during the update then the write 
is successful

What version of the product are you using?
pefile.py -> pefile.py-102

On what operating system?
Linux

Please provide any additional information below.

Original issue reported on code.google.com by sheldon_...@yahoo.com on 29 Apr 2011 at 1:21

GoogleCodeExporter commented 9 years ago
Currently, pefile is only capable of overwriting fields' values, not 
rearranging them. Therefore it will be unable to update fields with values 
larger than the one already in place.

Original comment by ero.carr...@gmail.com on 29 Apr 2011 at 3:58