diff options
-rw-r--r-- | MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c | 59 | ||||
-rw-r--r-- | MdeModulePkg/Universal/HiiDatabaseDxe/Font.c | 49 |
2 files changed, 68 insertions, 40 deletions
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c index 73c4e0f362..a60538d42f 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c @@ -664,6 +664,7 @@ HiiConfigRoutingExtractConfig ( EFI_STATUS Status;
LIST_ENTRY *Link;
HII_DATABASE_RECORD *Database;
+ UINT8 *DevicePathPkg;
UINT8 *CurrentDevicePath;
EFI_HANDLE DriverHandle;
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
@@ -750,8 +751,9 @@ HiiConfigRoutingExtractConfig ( Link = Link->ForwardLink
) {
Database = CR (Link, HII_DATABASE_RECORD, DatabaseEntry, HII_DATABASE_RECORD_SIGNATURE);
- CurrentDevicePath = Database->PackageList->DevicePathPkg + sizeof (EFI_HII_PACKAGE_HEADER);
- if (CurrentDevicePath != NULL) {
+
+ if ((DevicePathPkg = Database->PackageList->DevicePathPkg) != NULL) {
+ CurrentDevicePath = DevicePathPkg + sizeof (EFI_HII_PACKAGE_HEADER);
if (CompareMem (
DevicePath,
CurrentDevicePath,
@@ -877,7 +879,6 @@ HiiConfigRoutingExportConfig ( EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
EFI_STRING AccessProgress;
EFI_STRING AccessResults;
- UINTN TmpSize;
//
// For size reduction, please define PcdSupportFullConfigRoutingProtocol
@@ -943,9 +944,11 @@ HiiConfigRoutingExportConfig ( // Generate a <ConfigRequest> with one <ConfigHdr> and zero <RequestElement>.
// It means extract all possible configurations from this specific driver.
//
- TmpSize = StrLen (L"GUID=&NAME=&PATH=");
- RequestSize = (TmpSize + 32 + StrLen (Storage->Name) * 4)
- * sizeof (CHAR16) + PathHdrSize;
+ RequestSize = (StrLen (L"GUID=&NAME=&PATH=") + 32) * sizeof (CHAR16) + PathHdrSize;
+ if (Storage->Name != NULL) {
+ RequestSize += StrLen (Storage->Name) * 4 * sizeof (CHAR16);
+ }
+
ConfigRequest = (EFI_STRING) AllocateZeroPool (RequestSize);
if (ConfigRequest == NULL) {
SafeFreePool (PathHdr);
@@ -976,10 +979,12 @@ HiiConfigRoutingExportConfig ( StrnCpy (StringPtr, L"NAME=", StrLen (L"NAME="));
StringPtr += StrLen (L"NAME=");
- Length = (StrLen (Storage->Name) * 4 + 1) * sizeof (CHAR16);
- Status = UnicodeToConfigString (StringPtr, &Length, Storage->Name);
- ASSERT_EFI_ERROR (Status);
- StringPtr += StrLen (Storage->Name) * 4;
+ if (Storage->Name != NULL) {
+ Length = (StrLen (Storage->Name) * 4 + 1) * sizeof (CHAR16);
+ Status = UnicodeToConfigString (StringPtr, &Length, Storage->Name);
+ ASSERT_EFI_ERROR (Status);
+ StringPtr += StrLen (Storage->Name) * 4;
+ }
*StringPtr = L'&';
StringPtr++;
@@ -1101,6 +1106,7 @@ HiiConfigRoutingRouteConfig ( EFI_DEVICE_PATH_PROTOCOL *DevicePath;
LIST_ENTRY *Link;
HII_DATABASE_RECORD *Database;
+ UINT8 *DevicePathPkg;
UINT8 *CurrentDevicePath;
EFI_HANDLE DriverHandle;
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
@@ -1180,8 +1186,9 @@ HiiConfigRoutingRouteConfig ( Link = Link->ForwardLink
) {
Database = CR (Link, HII_DATABASE_RECORD, DatabaseEntry, HII_DATABASE_RECORD_SIGNATURE);
- CurrentDevicePath = Database->PackageList->DevicePathPkg + sizeof (EFI_HII_PACKAGE_HEADER);
- if (CurrentDevicePath != NULL) {
+
+ if ((DevicePathPkg = Database->PackageList->DevicePathPkg) != NULL) {
+ CurrentDevicePath = DevicePathPkg + sizeof (EFI_HII_PACKAGE_HEADER);
if (CompareMem (
DevicePath,
CurrentDevicePath,
@@ -1355,7 +1362,19 @@ HiiBlockToConfig ( Status = EFI_INVALID_PARAMETER;
goto Exit;
}
- while (*StringPtr++ != L'&');
+
+ while (*StringPtr != L'&' && *StringPtr != 0) {
+ StringPtr++;
+ }
+ if (*StringPtr == 0) {
+ *Progress = StringPtr;
+ Status = EFI_INVALID_PARAMETER;
+ goto Exit;
+ }
+ //
+ // Skip '&'
+ //
+ StringPtr++;
//
// Copy <ConfigHdr> and an additional '&' to <ConfigResp>
@@ -1604,7 +1623,19 @@ HiiConfigToBlock ( Status = EFI_INVALID_PARAMETER;
goto Exit;
}
- while (*StringPtr++ != L'&');
+
+ while (*StringPtr != L'&' && *StringPtr != 0) {
+ StringPtr++;
+ }
+ if (*StringPtr == 0) {
+ *Progress = StringPtr;
+ Status = EFI_INVALID_PARAMETER;
+ goto Exit;
+ }
+ //
+ // Skip '&'
+ //
+ StringPtr++;
//
// Parse each <ConfigElement> if exists
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c index 9c68ac89b6..23b15475da 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c @@ -1730,7 +1730,6 @@ HiiStringToImage ( if (LineHeight < Cell[Index].Height) {
LineHeight = (UINTN) Cell[Index].Height;
}
- BaseLineOffset += (UINTN) Cell[Index].OffsetY;
if ((Flags & EFI_HII_IGNORE_LINE_BREAK) == 0 &&
(Flags & EFI_HII_OUT_FLAG_WRAP) == 0 &&
@@ -1799,7 +1798,7 @@ HiiStringToImage ( if (Index > 0) {
RowInfo[RowIndex].EndIndex = Index - 1;
RowInfo[RowIndex].LineWidth = LineWidth - Cell[Index].AdvanceX;
- RowInfo[RowIndex].BaselineOffset = BaseLineOffset - Cell[Index].OffsetY;
+ RowInfo[RowIndex].BaselineOffset = BaseLineOffset;
if (LineHeight > Cell[Index - 1].Height) {
LineHeight = Cell[Index - 1].Height;
}
@@ -2497,10 +2496,10 @@ HiiGetFontInfo ( FontInfo->FontStyle = InfoOut.FontInfo.FontStyle;
if (IsFontInfoExisted (Private, FontInfo, &InfoOut.FontInfoMask, LocalFontHandle, &GlobalFont)) {
+ //
+ // Test to guarantee all characters are available in the found font.
+ //
if (String != NULL) {
- //
- // Test to guarantee all characters are available in the found font.
- //
StringIn = String;
while (*StringIn != 0) {
Status = FindGlyphBlock (GlobalFont->FontPackage, *StringIn, NULL, NULL, NULL);
@@ -2510,29 +2509,27 @@ HiiGetFontInfo ( }
StringIn++;
}
-
- //
- // Write to output parameter
- //
- if (StringInfoOut != NULL) {
- StringInfoOutLen = sizeof (EFI_FONT_DISPLAY_INFO) - sizeof (EFI_FONT_INFO) + GlobalFont->FontInfoSize;
- *StringInfoOut = (EFI_FONT_DISPLAY_INFO *) AllocateZeroPool (StringInfoOutLen);
- if (*StringInfoOut == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- LocalFontHandle = NULL;
- goto Exit;
- }
- CopyMem (*StringInfoOut, &InfoOut, sizeof (EFI_FONT_DISPLAY_INFO));
- CopyMem (&(*StringInfoOut)->FontInfo, GlobalFont->FontInfo, GlobalFont->FontInfoSize);
+ }
+ //
+ // Write to output parameter
+ //
+ if (StringInfoOut != NULL) {
+ StringInfoOutLen = sizeof (EFI_FONT_DISPLAY_INFO) - sizeof (EFI_FONT_INFO) + GlobalFont->FontInfoSize;
+ *StringInfoOut = (EFI_FONT_DISPLAY_INFO *) AllocateZeroPool (StringInfoOutLen);
+ if (*StringInfoOut == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ LocalFontHandle = NULL;
+ goto Exit;
}
- LocalFontHandle = GlobalFont->Entry.ForwardLink;
-
- Status = EFI_SUCCESS;
- goto Exit;
+
+ CopyMem (*StringInfoOut, &InfoOut, sizeof (EFI_FONT_DISPLAY_INFO));
+ CopyMem (&(*StringInfoOut)->FontInfo, GlobalFont->FontInfo, GlobalFont->FontInfoSize);
}
- } else {
- LocalFontHandle = NULL;
- }
+
+ LocalFontHandle = GlobalFont->Entry.ForwardLink;
+ Status = EFI_SUCCESS;
+ goto Exit;
+ }
Status = EFI_NOT_FOUND;
|