BaseTools: Use Stronger Matching for NULL Linked Libraries

To prevent the possibility that a library with a name like
NULLTestLib is interpreted as a NULL linked library, use
more explicit pattern matching to ensure that the library
name follows the pattern NULL%d.

Cc: Rebecca Cran <rebecca@bsdio.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Yuwei Chen <yuwei.chen@intel.com>

Signed-off-by: Taylor Beebe <taylor.d.beebe@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
Taylor Beebe
2024-02-28 10:47:23 -08:00
committed by mergify[bot]
parent d77efa2ebe
commit 5ba3602e45
2 changed files with 6 additions and 6 deletions

View File

@ -93,7 +93,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
if ModuleType != SUP_MODULE_USER_DEFINED and ModuleType != SUP_MODULE_HOST_APPLICATION:
for LibraryClass in PlatformDataBase.LibraryClasses.GetKeys():
if LibraryClass.startswith("NULL") and PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]:
if LibraryClass.startswith("NULL") and LibraryClass[4:].isdigit() and PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]:
self.InfModule.LibraryClasses[LibraryClass] = PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]
StrModule = str(self.InfModule)
@ -101,7 +101,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
if StrModule in PlatformDataBase.Modules:
PlatformModule = PlatformDataBase.Modules[StrModule]
for LibraryClass in PlatformModule.LibraryClasses:
if LibraryClass.startswith("NULL"):
if LibraryClass.startswith("NULL") and LibraryClass[4:].isdigit():
self.InfModule.LibraryClasses[LibraryClass] = PlatformModule.LibraryClasses[LibraryClass]
DependencyList = [self.InfModule]