Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-functional change in parse_rich_header #447

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions pefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3373,7 +3373,6 @@ def parse_rich_header(self):
"""

# Rich Header constants
#
DANS = 0x536E6144 # 'DanS' as dword
RICH = 0x68636952 # 'Rich' as dword

Expand Down Expand Up @@ -3417,7 +3416,7 @@ def parse_rich_header(self):
checksum = int.from_bytes(key, "little")
# the checksum should be present 3 times after the DanS signature
if (
data[0] ^ checksum != DANS
data[0] != DANS ^ checksum
or data[1] != checksum
or data[2] != checksum
or data[3] != checksum
Expand All @@ -3433,16 +3432,13 @@ def parse_rich_header(self):
data = data[4:]
for i in range(len(data) // 2):
# Stop until the Rich footer signature is found
#
if data[2 * i] == RICH:
# it should be followed by the checksum
#
if data[2 * i + 1] != checksum:
self.__warnings.append("Rich Header is malformed")
break

# header values come by pairs
#
headervalues += [data[2 * i] ^ checksum, data[2 * i + 1] ^ checksum]
return result

Expand Down
Loading