nanonyme / pefile

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

Problem with sections having zero SizeOfRawData #42

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Create PE-file with one of section having zero SizeOfRawData field and 
non-zero Misc.VirtualSize field. Or simply try to get any file compiled with 
Delphi (the '.tls' secion in these files fits to such requirement).

2. Load pe-file maked on step (1) and execute this code: 

   dword = pe.get_dword_at_rva(rva)
   print(dword)

   where rva is a beginning of the section that having zero SizeOfRawData and non-zero Misc.VirtualSize.

What is the expected output? What do you see instead?
Expected output is 0, but I see None.

What version of the product are you using? On what operating system?
pefile v1.2.10-123 on Windows 7 Professional x64 SP1.

Please provide any additional information below.
In attach the script and .exe showing that problem.

P.S. Sorry for bad English.

Original issue reported on code.google.com by readonly...@gmail.com on 27 Dec 2012 at 3:38

Attachments:

GoogleCodeExporter commented 9 years ago
If the output were zero it would mean that a dword of value 0 was read at the 
given rva. In this case the given rva refers to an address that, while 
contained within a section in memory, it refers to bytes that do not exist in 
the file (SizeOfRawData = 0). I believe that returning None better represents 
the fact that there's nothing to be read from the file at that rva.

Original comment by ero.carr...@gmail.com on 4 Dec 2013 at 4:42