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

BaseTools: Fix NoneType parent reference in FMMT operations #10614

Conversation

AshrafAliS
Copy link
Contributor

This patch addresses an issue in the FMMT operations where the parent reference is not checked for NoneType. This oversight can lead to an AttributeError: 'NoneType' object has no attribute 'Name' when attempting to access the parent reference. The fix involves adding a check for NoneType before accessing the parent reference to ensure that the operations handle such cases gracefully.

The affected functions include:

  • AddNewFfs
  • ReplaceFfs
  • ExtractFfs

These functions now include proper checks to prevent the AttributeError.

  • Breaking change?
    • Breaking change - Does this PR cause a break in build or boot behavior?
    • Examples: Does it add a new library class or move a module to a different repo.
  • Impacts security?
    • Security - Does this PR have a direct security impact?
    • Examples: Crypto algorithm change or buffer overflow fix.
  • Includes tests?
    • Tests - Does this PR include any explicit test code?
    • Examples: Unit tests or integration tests.

How This Was Tested

Regular FMMT operation

Integration Instructions

N/A

@AshrafAliS
Copy link
Contributor Author

AshrafAliS commented Jan 12, 2025

Fixes #10557

@AshrafAliS
Copy link
Contributor Author

any updates on this PR

@mdkinney
Copy link
Member

Minor issue in commit message. There are duplicate Signed-off-by lines

This patch addresses an issue in the FMMT operations where the parent
reference is not checked for NoneType. This oversight can lead to an
AttributeError: 'NoneType' object has no attribute 'Name' when
attempting to access the parent reference. The fix involves adding a
check for NoneType before accessing the parent reference to ensure that
the operations handle such cases gracefully.

The affected functions include:
- AddNewFfs
- ReplaceFfs
- ExtractFfs

These functions now include proper checks to prevent the AttributeError.

Signed-off-by: Ashraf Ali S <[email protected]>
@AshrafAliS AshrafAliS force-pushed the Fix_FMMTOperation_While_Accessing_NoneType_Object branch from d68399f to 88dc805 Compare January 23, 2025 16:09
@AshrafAliS
Copy link
Contributor Author

updated the commit message :)

@AshrafAliS AshrafAliS added the push Auto push patch series in PR if all checks pass label Jan 27, 2025
@mergify mergify bot merged commit 6d2143f into tianocore:master Jan 27, 2025
126 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
push Auto push patch series in PR if all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BaseTools FMMT handle case where Parent.Data is none (previously easier bug report?)
2 participants