microsoft / mu_basecore

Project Mu BaseCore
https://microsoft.github.io/mu/
Other
242 stars 124 forks source link

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

Closed Javagedes closed 1 month ago

Javagedes commented 1 month ago

Description

This commit modifies the PE parsing functionality to only parse the headers of the image, rather than the entire image. This change is made to improve performance and also the probability of failing to parse the entire image. This comes after this commit (https://github.com/erocarrera/pefile/pull/365) in pefile resulted in efi image parsing failures, breaking the build.

This commit also wraps the parsing of the image in a try-except block to catch any exceptions that may be raised during parsing, to cleanly exit.

See: https://github.com/microsoft/mu_tiano_platforms/pull/1025 and https://github.com/erocarrera/pefile/issues/421

How This Was Tested

Validated pipelines build on mu_tiano_platforms

Integration Instructions

N/A

codecov-commenter commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 1.35%. Comparing base (750b5cd) to head (2e8f844).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## release/202311 #1126 +/- ## =============================================== Coverage 1.35% 1.35% =============================================== Files 1303 1303 Lines 333838 333838 Branches 5103 5103 =============================================== Hits 4512 4512 Misses 329243 329243 Partials 83 83 ``` | [Flag](https://app.codecov.io/gh/microsoft/mu_basecore/pull/1126/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) | Coverage Δ | | |---|---|---| | [MdeModulePkg](https://app.codecov.io/gh/microsoft/mu_basecore/pull/1126/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) | `0.68% <ø> (ø)` | | | [MdePkg](https://app.codecov.io/gh/microsoft/mu_basecore/pull/1126/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) | `5.40% <ø> (ø)` | | | [NetworkPkg](https://app.codecov.io/gh/microsoft/mu_basecore/pull/1126/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) | `0.55% <ø> (ø)` | | | [PolicyServicePkg](https://app.codecov.io/gh/microsoft/mu_basecore/pull/1126/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) | `30.41% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.