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

[202311] ImageValidation.py: Don't parse entire image #1126

Merged
Merged
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
7 changes: 5 additions & 2 deletions .pytool/Plugin/ImageValidation/ImageValidation.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ def do_post_build(self, thebuilder):

# Load Configuration Data
config_path = thebuilder.env.GetValue("PE_VALIDATION_PATH", None)
tool_chain_tag = thebuilder.env.GetValue("TOOL_CHAIN_TAG")
if config_path is None:
logging.info("PE_VALIDATION_PATH not set, Using default configuration")
logging.info("Review ImageValidation/Readme.md for configuration options.")
Expand Down Expand Up @@ -232,7 +231,11 @@ def do_post_build(self, thebuilder):

# Executes run_tests() on the efi
def _validate_image(self, efi_path, profile="DEFAULT"):
pe = PE(efi_path)
try:
pe = PE(efi_path, fast_load=True)
except Exception:
logging.error(f'Failed to parse {os.path.basename(efi_path)}')
return Result.FAIL

target_config = self.config_data[MACHINE_TYPE[pe.FILE_HEADER.Machine]].get(
profile)
Expand Down
Loading