From 08e6463a72f816b51793327ab5b0f2af08b9db1c Mon Sep 17 00:00:00 2001 From: qwang12 Date: Tue, 2 Sep 2008 01:21:43 +0000 Subject: Merged in the bug fixes from EDK I. *** Press F9 in Uefi64 FrontPage shouldnot enter sub-menu ** [FT] Some UI error on multiple platforms on framework_20080811 ** [FT] UI test of How tall are you(Hex) on framework_20080811 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5767 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/HiiDatabaseDxe/ConfigRouting.c | 59 +++++++++++++++++----- MdeModulePkg/Universal/HiiDatabaseDxe/Font.c | 49 +++++++++--------- 2 files changed, 68 insertions(+), 40 deletions(-) (limited to 'MdeModulePkg/Universal/HiiDatabaseDxe') 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 with one and zero . // 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 and an additional '&' to @@ -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 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; -- cgit v1.2.3